Skip to content

Commit 2005ef4

Browse files
chore: Added an action to run dotnet tests (#182)
Also fixed a couple of test-cases that did not work on Linux
1 parent 416f7e6 commit 2005ef4

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.github/workflows/cs-tests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: C# tests
2+
on:
3+
push:
4+
jobs:
5+
tests:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout repository
9+
uses: actions/checkout@v4
10+
- name: Setup .NET
11+
uses: actions/setup-dotnet@v4
12+
with:
13+
dotnet-version: '9.0'
14+
- name: Run tests
15+
run: dotnet test MN.L10n.Tests

MN.L10n.Tests/JavascriptTranslationMiddleware/TranslatedFileProviderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void HandlesPluralizedPhrase()
4141

4242
var translation = translator.TranslateFileContents("_s(\"$__count$ minuter sedan\", {__count: 7});");
4343

44-
Assert.Equal($"(function(){{ var x = l10n.Phrases;x[\"{phrase}\"] = {{\"r\":{{\"0\":\"Now\",\"1\":\"$__count$ minutes ago\"}}}}; }})();\r\n_s(\"$__count$ minuter sedan\", {{__count: 7}});", translation);
44+
Assert.Equal($"(function(){{ var x = l10n.Phrases;x[\"{phrase}\"] = {{\"r\":{{\"0\":\"Now\",\"1\":\"$__count$ minutes ago\"}}}}; }})();{Environment.NewLine}_s(\"$__count$ minuter sedan\", {{__count: 7}});", translation);
4545
}
4646

4747
[Fact]
@@ -53,7 +53,7 @@ public void HandlesPluralizedPhraseInEval()
5353

5454
var translation = translator.TranslateFileContents("eval(\"_s(\\\"$__count$ minuter sedan\\\", {__count: 7});\");");
5555

56-
Assert.Equal($"(function(){{ var x = l10n.Phrases;x[\"{phrase}\"] = {{\"r\":{{\"0\":\"Now\",\"1\":\"$__count$ minutes ago\"}}}}; }})();\r\neval(\"_s(\\\"$__count$ minuter sedan\\\", {{__count: 7}});\");", translation);
56+
Assert.Equal($"(function(){{ var x = l10n.Phrases;x[\"{phrase}\"] = {{\"r\":{{\"0\":\"Now\",\"1\":\"$__count$ minutes ago\"}}}}; }})();{Environment.NewLine}eval(\"_s(\\\"$__count$ minuter sedan\\\", {{__count: 7}});\");", translation);
5757
}
5858

5959
[Fact]

MN.L10n.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1616
LICENSE.txt = LICENSE.txt
1717
README.md = README.md
1818
TROUBLESHOOTING.md = TROUBLESHOOTING.md
19+
.github\workflows\cs-tests.yml = .github\workflows\cs-tests.yml
1920
EndProjectSection
2021
EndProject
2122
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MN.L10n.Javascript", "MN.L10n.Javascript\MN.L10n.Javascript.csproj", "{C2F42349-0F94-4291-A5E9-62806A3960FA}"

0 commit comments

Comments
 (0)