Skip to content

Commit 87953c1

Browse files
authored
Merge pull request #26 from xt0rted/xt0rted-patch-1
Set LogFilePrefix for test result files
2 parents 3f9eb1b + 8a4a18b commit 87953c1

File tree

5 files changed

+26
-19
lines changed

5 files changed

+26
-19
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,19 @@ jobs:
140140
141141
- run: |
142142
if [ "${{ matrix.shell }}" == "default" ]; then
143-
dotnet r test --verbose
143+
dotnet r test --verbose -- --logger "trx;LogFilePrefix=${{ matrix.os }}-integration-tests"
144144
else
145-
dotnet r test --verbose --script-shell "${{ matrix.shell }}"
145+
dotnet r test --verbose --script-shell "${{ matrix.shell }}" -- --logger "trx;LogFilePrefix=${{ matrix.os }}-integration-tests"
146146
fi
147147
shell: bash
148148
149+
- name: Upload test results
150+
uses: actions/[email protected]
151+
if: always()
152+
with:
153+
name: integration-test-results
154+
path: ./.coverage/*.trx
155+
149156
release:
150157
if: github.event_name == 'push'
151158

.github/workflows/test-results.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ jobs:
2626
name: .NET Tests
2727
path: "*.trx"
2828
reporter: dotnet-trx
29+
30+
- uses: dorny/[email protected]
31+
with:
32+
artifact: integration-test-results
33+
name: .NET Tests
34+
path: "*.trx"
35+
reporter: dotnet-trx

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"clean:bin": "dotnet rimraf **/bin **/obj",
1010
"prebuild": "dotnet r clean",
1111
"build": "dotnet build",
12-
"test": "dotnet test --no-build --logger \"trx\" --results-directory \"./.coverage\"",
12+
"test": "dotnet test --no-build --logger \"trx;LogFilePrefix=tests\" --results-directory \"./.coverage\"",
1313
"test:31": "dotnet r test -- --framework netcoreapp3.1",
1414
"test:5": "dotnet r test -- --framework net5.0",
1515
"test:6": "dotnet r test -- --framework net6.0",

src/ArgumentBuilder.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,9 @@ public static string ConcatinateCommandAndArgArrayForDisplay(
107107

108108
private static void EscapeSingleArg(ref ValueStringBuilder sb, ReadOnlySpan<char> arg)
109109
{
110-
var needsQuotes = arg.Length == 0 || ArgumentContainsWhitespace(arg);
111-
var isQuoted = needsQuotes || IsSurroundedWithQuotes(arg);
110+
var isQuoted = IsSurroundedWithQuotes(arg);
112111

113-
if (needsQuotes)
114-
{
115-
sb.Append(Quote);
116-
}
112+
sb.Append(Quote);
117113

118114
for (var i = 0; i < arg.Length; ++i)
119115
{
@@ -157,10 +153,7 @@ private static void EscapeSingleArg(ref ValueStringBuilder sb, ReadOnlySpan<char
157153
}
158154
}
159155

160-
if (needsQuotes)
161-
{
162-
sb.Append(Quote);
163-
}
156+
sb.Append(Quote);
164157
}
165158

166159
/// <summary>

test/ArgumentBuilderTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ public class ArgumentBuilderTests
88
[InlineData("cm \"d\"", null, "cm \"d\"")]
99
[InlineData("c m d", null, "c m d")]
1010
[InlineData("c m d", new string[0], "c m d")]
11-
[InlineData("c m d", new[] { "one", "two", "three" }, "c m d one two three")]
11+
[InlineData("c m d", new[] { "one", "two", "three" }, "c m d \"one\" \"two\" \"three\"")]
1212
[InlineData("c m d", new[] { "line1\nline2", "word1\tword2" }, "c m d \"line1\nline2\" \"word1\tword2\"")]
1313
[InlineData("c m d", new[] { "with spaces" }, "c m d \"with spaces\"")]
14-
[InlineData("c m d", new[] { @"with\backslash" }, @"c m d with\backslash")]
15-
[InlineData("c m d", new[] { @"""quotedwith\backslash""" }, @"c m d \""quotedwith\backslash\""")]
16-
[InlineData("c m d", new[] { @"C:\Users\" }, @"c m d C:\Users\")]
17-
[InlineData("c m d", new[] { @"C:\Program Files\dotnet\" }, @"c m d ""C:\Program Files\dotnet\\""")]
18-
[InlineData("c m d", new[] { @"backslash\""preceedingquote" }, @"c m d backslash\\\""preceedingquote")]
14+
[InlineData("c m d", new[] { @"with\backslash" }, @"c m d ""with\backslash""")]
15+
[InlineData("c m d", new[] { @"""quotedwith\backslash""" }, @"c m d ""\""quotedwith\backslash\""""")]
16+
[InlineData("c m d", new[] { @"C:\Users\" }, @"c m d ""C:\Users\""")]
17+
[InlineData("c m d", new[] { @"C:\Program Files\dotnet\" }, @"c m d ""C:\Program Files\dotnet\""")]
18+
[InlineData("c m d", new[] { @"backslash\""preceedingquote" }, @"c m d ""backslash\\\""preceedingquote""")]
1919
[InlineData("c m d", new[] { @""" hello """ }, @"c m d ""\"" hello \""""")]
2020
public void EscapeAndConcatenateCommandAndArgArrayForProcessStart(string command, string[] args, string expected)
2121
{

0 commit comments

Comments
 (0)