C#: Unit tests.

This commit is contained in:
calum
2018-10-31 12:01:43 +00:00
parent 681953ae70
commit 8bea6fa7c9
2 changed files with 23 additions and 0 deletions

View File

@@ -33,6 +33,8 @@ namespace Semmle.Extraction.Tests
FileExistsIn.Add(file);
if (FileExists.TryGetValue(file, out var ret))
return ret;
if (FileExists.TryGetValue(System.IO.Path.GetFileName(file), out ret))
return ret;
throw new ArgumentException("Missing FileExists " + file);
}

View File

@@ -1,6 +1,8 @@
using Xunit;
using Semmle.Util.Logging;
using System;
using System.IO;
using Semmle.Util;
namespace Semmle.Extraction.Tests
{
@@ -184,5 +186,24 @@ namespace Semmle.Extraction.Tests
options = CSharp.Options.CreateWithEnvironment(new string[] {});
Assert.True(options.Fast);
}
[Fact]
public void ArchiveArguments()
{
var file1 = Path.GetTempFileName();
var file2 = Path.GetTempFileName();
try
{
File.AppendAllText(file1, "Test");
new string[] { "/noconfig", "@" + file1 }.ArchiveCommandLine(file2);
Assert.Equal("Test", File.ReadAllText(file2));
}
finally
{
File.Delete(file1);
File.Delete(file2);
}
}
}
}