Skip to content

Commit

Permalink
Add couple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kant2002 committed Oct 5, 2023
1 parent dedde96 commit 7779e91
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Cesium.Compiler.Tests/CommandLineParsingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public async Task PreprocessFile()
Assert.Equal(0, errorCode);
}

[Fact(Skip = "CommandLineParser cannot handle this case. We need to parse differently")]
[Fact]
public async Task MultipleIncludeFiles()
{
var args = new[] { "C:\\Cesium\\Cesium.Samples\\getopt.c", "-o", "C:\\\\Cesium\\\\Cesium.IntegrationTests/bin/doom.exe", "-I", "C:\\\\Cesium\\\\Cesium.Samples\\\\", "-I", "\"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\um\\\"" };
Expand All @@ -97,7 +97,25 @@ public async Task MultipleIncludeFiles()
{
Assert.Equal(new[] { "C:\\Cesium\\Cesium.Samples\\getopt.c" }, args.InputFilePaths);
Assert.Equal("C:\\\\Cesium\\\\Cesium.IntegrationTests/bin/doom.exe", args.OutputFilePath);
Assert.Equal(new[] { "C:\\\\Cesium\\\\Cesium.Samples\\\\", "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\um\\" }, args.IncludeDirectories);
Assert.Equal(new[] { "C:\\\\Cesium\\\\Cesium.Samples\\\\", "\"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\um\\\"" }, args.IncludeDirectories);
return Task.FromResult(0);
});
NoInformationalMessages(reporter);
Assert.Empty(reporter.Errors);
Assert.Equal(0, errorCode);
}

[Fact]
public async Task MultipleDefinesFiles()
{
var args = new[] { "C:\\Cesium\\Cesium.Samples\\getopt.c", "-o", "C:\\\\Cesium\\\\Cesium.IntegrationTests/bin/doom.exe", "-D", "TEST_1", "-D", "TEST_2" };
var reporter = new MockCompilerReporter();

var errorCode = await CommandLineParser.ParseCommandLineArgs(args, reporter, args =>
{
Assert.Equal(new[] { "C:\\Cesium\\Cesium.Samples\\getopt.c" }, args.InputFilePaths);
Assert.Equal("C:\\\\Cesium\\\\Cesium.IntegrationTests/bin/doom.exe", args.OutputFilePath);
Assert.Equal(new[] { "TEST_1", "TEST_2" }, args.DefineConstant);
return Task.FromResult(0);
});
NoInformationalMessages(reporter);
Expand Down

0 comments on commit 7779e91

Please sign in to comment.