Unverified Commit 3dc04b3a authored by Ivv's avatar Ivv Committed by GitHub
Browse files

Merge pull request #190930 from corngood/omnisharp-roslyn-tests

omnisharp-roslyn: add tests
parents d31bacec 07290f1e
Loading
Loading
Loading
Loading
+41 −2
Original line number Diff line number Diff line
@@ -5,11 +5,13 @@
, lib
, patchelf
, stdenv
, runCommand
, expect
}:
let
  inherit (dotnetCorePackages) sdk_6_0;
in
buildDotnetModule rec {
let finalPackage = buildDotnetModule rec {
  pname = "omnisharp-roslyn";
  version = "1.39.1";

@@ -72,6 +74,43 @@ buildDotnetModule rec {
    rm $out/lib/omnisharp-roslyn/System.Configuration.ConfigurationManager.dll
  '';

  passthru.tests = {
    no-sdk = runCommand "no-sdk" { nativeBuildInputs = [ finalPackage expect ]; meta.timeout = 60; } ''
      HOME=$TMPDIR
      expect <<"EOF"
        spawn OmniSharp
        expect_before timeout {
          send_error "timeout!\n"
          exit 1
        }
        expect "\"ERROR\",\"Name\":\"OmniSharp.MSBuild.Discovery.Providers.SdkInstanceProvider\""
        expect eof
        catch wait result
        if { [lindex $result 3] == 0 } {
          exit 1
        }
      EOF
      touch $out
    '';

    with-sdk = runCommand "with-sdk" { nativeBuildInputs = [ finalPackage sdk_6_0 expect ]; meta.timeout = 60; } ''
      HOME=$TMPDIR
      expect <<"EOF"
        spawn OmniSharp
        expect_before timeout {
          send_error "timeout!\n"
          exit 1
        }
        expect "{\"Event\":\"started\","
        send \x03
        expect eof
        catch wait result
        exit [lindex $result 3]
      EOF
      touch $out
    '';
  };

  meta = with lib; {
    description = "OmniSharp based on roslyn workspaces";
    homepage = "https://github.com/OmniSharp/omnisharp-roslyn";
@@ -83,4 +122,4 @@ buildDotnetModule rec {
    maintainers = with maintainers; [ tesq0 ericdallo corngood mdarocha ];
    mainProgram = "OmniSharp";
  };
}
}; in finalPackage