Skip to content

Commit 09888cb

Browse files
committed
Make tests cross-platform compatible
1 parent 99940d0 commit 09888cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void ShouldOutputDotEnvEntries(string variableName, string expectedValue)
9797

9898
outputGenerator.Execute(versionVariables, new());
9999
var output = consoleBuilder.ToString();
100-
output.ShouldContain("GitVersion_" + variableName + "=" + expectedValue + "\n");
100+
output.ShouldContain($"GitVersion_{variableName}={expectedValue}{SysEnv.NewLine}");
101101
}
102102

103103
[TestCase]
@@ -123,7 +123,7 @@ public void ShouldOutputAllCalculatedVariablesAsDotEnvEntries()
123123

124124
outputGenerator.Execute(versionVariables, new());
125125
var output = consoleBuilder.ToString();
126-
var totalOutputLines = output.Split("\n").Length - 1; // ignore last item that also ends with \n
126+
var totalOutputLines = output.Split(SysEnv.NewLine).Length - 1; // ignore last item that also ends with the newline string
127127
Assert.That(totalOutputLines, Is.EqualTo(versionVariables.Count()));
128128
}
129129

@@ -158,7 +158,7 @@ public void ShouldOutputAllDotEnvEntriesEvenForMinimalRepositories(string variab
158158

159159
outputGenerator.Execute(versionVariables, new());
160160
var output = consoleBuilder.ToString();
161-
output.ShouldContain("GitVersion_" + variableName + "=" + expectedValue + "\n");
161+
output.ShouldContain($"GitVersion_{variableName}={expectedValue}{SysEnv.NewLine}");
162162
}
163163

164164
[TestCase]
@@ -184,7 +184,7 @@ public void ShouldOutputAllCalculatedVariablesAsDotEnvEntriesEvenForMinimalRepos
184184

185185
outputGenerator.Execute(versionVariables, new());
186186
var output = consoleBuilder.ToString();
187-
var totalOutputLines = output.Split("\n").Length - 1; // ignore last item that also ends with \n
187+
var totalOutputLines = output.Split(SysEnv.NewLine).Length - 1; // ignore last item that also ends with the newline string
188188
Assert.That(totalOutputLines, Is.EqualTo(versionVariables.Count()));
189189
}
190190

0 commit comments

Comments
 (0)