33
44using System ;
55using System . IO ;
6- using System . Text ;
76using System . Threading . Tasks ;
8- using System . Text . RegularExpressions ;
97using Xunit ;
108using Xunit . Abstractions ;
119using Xunit . Sdk ;
1210
13-
1411#nullable enable
1512
1613namespace Wasm . Build . Tests
@@ -32,6 +29,7 @@ private void updateProgramCS() {
3229 var path = Path . Combine ( _projectDir ! , "Program.cs" ) ;
3330 string text = File . ReadAllText ( path ) ;
3431 text = text . Replace ( @"Console.WriteLine(""Hello, Console!"");" , programText ) ;
32+ text = text . Replace ( "return 0;" , "return 42;" ) ;
3533 File . WriteAllText ( path , text ) ;
3634 }
3735
@@ -162,7 +160,7 @@ public void ConsoleBuildAndRun(string config)
162160 AssertDotNetJsSymbols ( Path . Combine ( GetBinDir ( config ) , "AppBundle" ) , fromRuntimePack : true ) ;
163161
164162 ( int exitCode , string output ) = RunProcess ( s_buildEnv . DotNet , _testOutput , args : $ "run --no-build -c { config } x y z", workingDir : _projectDir ) ;
165- Assert . Equal ( 0 , exitCode ) ;
163+ Assert . Equal ( 42 , exitCode ) ;
166164 Assert . Contains ( "args[0] = x" , output ) ;
167165 Assert . Contains ( "args[1] = y" , output ) ;
168166 Assert . Contains ( "args[2] = z" , output ) ;
@@ -209,7 +207,7 @@ public void ConsolePublishAndRun(string config, bool aot)
209207 var res = new RunCommand ( s_buildEnv , _testOutput , label : id )
210208 . WithWorkingDirectory ( _projectDir ! )
211209 . ExecuteWithCapturedOutput ( runArgs )
212- . EnsureSuccessful ( ) ;
210+ . EnsureExitCode ( 42 ) ;
213211
214212 if ( aot )
215213 Assert . Contains ( $ "AOT: image '{ Path . GetFileNameWithoutExtension ( projectFile ) } ' found", res . Output ) ;
0 commit comments