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

omnisharp-roslyn: add tests

authored by Ivv and committed by GitHub 3dc04b3a d31bacec

+41 -2
+41 -2
pkgs/development/tools/omnisharp-roslyn/default.nix
··· 5 , lib 6 , patchelf 7 , stdenv 8 }: 9 let 10 inherit (dotnetCorePackages) sdk_6_0; 11 in 12 - buildDotnetModule rec { 13 pname = "omnisharp-roslyn"; 14 version = "1.39.1"; 15 ··· 72 rm $out/lib/omnisharp-roslyn/System.Configuration.ConfigurationManager.dll 73 ''; 74 75 meta = with lib; { 76 description = "OmniSharp based on roslyn workspaces"; 77 homepage = "https://github.com/OmniSharp/omnisharp-roslyn"; ··· 83 maintainers = with maintainers; [ tesq0 ericdallo corngood mdarocha ]; 84 mainProgram = "OmniSharp"; 85 }; 86 - }
··· 5 , lib 6 , patchelf 7 , stdenv 8 + , runCommand 9 + , expect 10 }: 11 let 12 inherit (dotnetCorePackages) sdk_6_0; 13 in 14 + let finalPackage = buildDotnetModule rec { 15 pname = "omnisharp-roslyn"; 16 version = "1.39.1"; 17 ··· 74 rm $out/lib/omnisharp-roslyn/System.Configuration.ConfigurationManager.dll 75 ''; 76 77 + passthru.tests = { 78 + no-sdk = runCommand "no-sdk" { nativeBuildInputs = [ finalPackage expect ]; meta.timeout = 60; } '' 79 + HOME=$TMPDIR 80 + expect <<"EOF" 81 + spawn OmniSharp 82 + expect_before timeout { 83 + send_error "timeout!\n" 84 + exit 1 85 + } 86 + expect "\"ERROR\",\"Name\":\"OmniSharp.MSBuild.Discovery.Providers.SdkInstanceProvider\"" 87 + expect eof 88 + catch wait result 89 + if { [lindex $result 3] == 0 } { 90 + exit 1 91 + } 92 + EOF 93 + touch $out 94 + ''; 95 + 96 + with-sdk = runCommand "with-sdk" { nativeBuildInputs = [ finalPackage sdk_6_0 expect ]; meta.timeout = 60; } '' 97 + HOME=$TMPDIR 98 + expect <<"EOF" 99 + spawn OmniSharp 100 + expect_before timeout { 101 + send_error "timeout!\n" 102 + exit 1 103 + } 104 + expect "{\"Event\":\"started\"," 105 + send \x03 106 + expect eof 107 + catch wait result 108 + exit [lindex $result 3] 109 + EOF 110 + touch $out 111 + ''; 112 + }; 113 + 114 meta = with lib; { 115 description = "OmniSharp based on roslyn workspaces"; 116 homepage = "https://github.com/OmniSharp/omnisharp-roslyn"; ··· 122 maintainers = with maintainers; [ tesq0 ericdallo corngood mdarocha ]; 123 mainProgram = "OmniSharp"; 124 }; 125 + }; in finalPackage