Skip to content

Commit 81e4cdd

Browse files
authored
Merge pull request github#14333 from michaelnebel/csharp/windowsunittests
C#: Also run extractor unit tests on a windows runner.
2 parents dbecb1b + c25113a commit 81e4cdd

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/workflows/csharp-qltest.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ jobs:
6565
env:
6666
GITHUB_TOKEN: ${{ github.token }}
6767
unit-tests:
68-
runs-on: ubuntu-latest
68+
strategy:
69+
matrix:
70+
os: [ubuntu-latest, windows-2019]
71+
runs-on: ${{ matrix.os }}
6972
steps:
7073
- uses: actions/checkout@v4
7174
- name: Setup dotnet
@@ -78,6 +81,7 @@ jobs:
7881
dotnet test -p:RuntimeFrameworkVersion=7.0.2 extractor/Semmle.Extraction.Tests
7982
dotnet test -p:RuntimeFrameworkVersion=7.0.2 autobuilder/Semmle.Autobuild.CSharp.Tests
8083
dotnet test -p:RuntimeFrameworkVersion=7.0.2 "${{ github.workspace }}/cpp/autobuilder/Semmle.Autobuild.Cpp.Tests"
84+
shell: bash
8185
stubgentest:
8286
runs-on: ubuntu-latest
8387
steps:

csharp/extractor/Semmle.Extraction.CSharp.StubGenerator/StubGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private static void StubReference(ILogger logger, CSharpCompilation compilation,
6868
var stubPath = FileUtils.NestPaths(logger, outputPath, path.Replace(".dll", ".cs"));
6969
stubPaths.Add(stubPath);
7070
using var fileStream = new FileStream(stubPath, FileMode.Create, FileAccess.Write);
71-
using var writer = new StreamWriter(fileStream, new UTF8Encoding(false));
71+
using var writer = new StreamWriter(fileStream, new UTF8Encoding(false)) { NewLine = "\n" };
7272

7373
var visitor = new StubVisitor(writer, relevantSymbol);
7474

csharp/extractor/Semmle.Extraction.Tests/StubGenerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Semmle.Extraction.Tests;
1313
/// </summary>
1414
public class StubGeneratorTests
1515
{
16-
// [Fact]
16+
[Fact]
1717
public void StubGeneratorFieldTest()
1818
{
1919
// Setup
@@ -36,7 +36,7 @@ public class MyTest {
3636
Assert.Equal(expected, stub);
3737
}
3838

39-
// [Fact]
39+
[Fact]
4040
public void StubGeneratorMethodTest()
4141
{
4242
// Setup
@@ -61,7 +61,7 @@ private static string GenerateStub(string source)
6161
var st = CSharpSyntaxTree.ParseText(source);
6262
var compilation = CSharpCompilation.Create(null, new[] { st });
6363
var sb = new StringBuilder();
64-
var visitor = new StubVisitor(new StringWriter(sb), new RelevantSymbolStub());
64+
var visitor = new StubVisitor(new StringWriter(sb) { NewLine = "\n" }, new RelevantSymbolStub());
6565
compilation.GlobalNamespace.Accept(visitor);
6666
return sb.ToString();
6767
}

0 commit comments

Comments
 (0)