Skip to content

Commit

Permalink
mono-basic update: Command returns the raw command line without arg0.
Browse files Browse the repository at this point in the history
For #116.
  • Loading branch information
Esme Povirk committed Oct 30, 2021
1 parent 189f210 commit d5ddda4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mono-basic
45 changes: 45 additions & 0 deletions tools/tests/interactioncommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Diagnostics;
using System.Reflection;
using Microsoft.VisualBasic;

public class InteractionCommandTest
{
public static void TestCommand (string cmd)
{
var process = new Process();
process.StartInfo.FileName = Assembly.GetExecutingAssembly().Location;
process.StartInfo.Arguments = cmd;
process.StartInfo.UseShellExecute = false;
process.StartInfo.EnvironmentVariables.Add ("EXPECTED_INTERACTION_COMMAND", "_" + cmd);
process.Start ();
process.WaitForExit ();
if (process.ExitCode != 0)
{
Environment.Exit (1);
}
}

public static int Main (string[] args)
{
if (Environment.GetEnvironmentVariable ("EXPECTED_INTERACTION_COMMAND") != null)
{
if (Environment.GetEnvironmentVariable ("EXPECTED_INTERACTION_COMMAND").Substring (1) != Interaction.Command ())
{
Console.WriteLine ("Expected '{0}' got '{1}'",
Environment.GetEnvironmentVariable ("EXPECTED_INTERACTION_COMMAND").Substring (1),
Interaction.Command ());
return 1;
}
}
else
{
TestCommand ("");
TestCommand ("\"\"");
TestCommand ("\"test with quotes\"");
TestCommand ("test without quotes");
}

return 0;
}
}
3 changes: 3 additions & 0 deletions tools/tests/tests.make
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TEST_CS_EXE_SRCS = \
arraypadding.cs \
dllimport-cctor.cs \
dllimport-preload.cs \
interactioncommand.cs \
marshalansi.cs \
mixedmode-call.cs \
mixedmode-dllimport-0.cs \
Expand Down Expand Up @@ -80,6 +81,8 @@ tools/tests/privatepath2.exe: tools/tests/testcslib1.dll tools/tests/testcslib2.

tools/tests/wpfclipboard.exe: $(SRCDIR)/wpf/src/Microsoft.DotNet.Wpf/src/PresentationCore/.built

tools/tests/interactioncommand.exe: $(BUILDDIR)/Microsoft.VisualBasic.dll

tools/tests/vbstartup.exe: $(BUILDDIR)/Microsoft.VisualBasic.dll

tools/tests/net_4_x_%_test.dll: $(BUILDDIR)/nunitlite.dll
Expand Down

0 comments on commit d5ddda4

Please sign in to comment.