Skip to content

Commit 9ae597c

Browse files
Fixed tests to use exe name, rather than hardcoding testhost
The exe name appears to differ in CI
1 parent 1f9dcbe commit 9ae597c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/System.CommandLine.Tests/ParserTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ public void Location_in_ValueResult_correct_for_arguments()
17481748
{
17491749
command
17501750
};
1751-
var expectedOuterLocation = new Location("testhost", Location.User, -1, null);
1751+
var expectedOuterLocation = new Location(CliExecutable.ExecutableName, Location.User, -1, null);
17521752
var expectedLocation1 = new Location("Kirk", Location.User, 1, expectedOuterLocation);
17531753
var expectedLocation2 = new Location("Spock", Location.User, 2, expectedOuterLocation);
17541754

@@ -1775,7 +1775,7 @@ public void Location_in_ValueResult_correct_for_options()
17751775
{
17761776
command
17771777
};
1778-
var expectedOuterLocation = new Location("testhost", Location.User, -1, null);
1778+
var expectedOuterLocation = new Location(CliExecutable.ExecutableName, Location.User, -1, null);
17791779
var expectedLocation1 = new Location("Kirk", Location.User, 3, expectedOuterLocation);
17801780
var expectedLocation2 = new Location("Spock", Location.User, 5, expectedOuterLocation);
17811781

@@ -1802,7 +1802,7 @@ public void Location_offsets_in_ValueResult_correct_for_arguments()
18021802
{
18031803
command
18041804
};
1805-
var expectedOuterLocation = new Location("testhost", Location.User, -1, null);
1805+
var expectedOuterLocation = new Location(CliExecutable.ExecutableName, Location.User, -1, null);
18061806
var expectedLocation1 = new Location("Kirk", Location.User, 1, expectedOuterLocation);
18071807
var expectedLocation2 = new Location("Spock", Location.User, 2, expectedOuterLocation);
18081808

@@ -1826,7 +1826,7 @@ public void Location_offsets_in_ValueResult_correct_for_options()
18261826
{
18271827
command
18281828
};
1829-
var expectedOuterLocation = new Location("testhost", Location.User, -1, null);
1829+
var expectedOuterLocation = new Location(CliExecutable.ExecutableName, Location.User, -1, null);
18301830
var expectedLocation1 = new Location("Kirk", Location.User, 3, expectedOuterLocation);
18311831
var expectedLocation2 = new Location("Spock", Location.User, 5, expectedOuterLocation);
18321832

@@ -1852,7 +1852,7 @@ public void Location_offset_correct_when_colon_or_equal_used()
18521852
{
18531853
command
18541854
};
1855-
var expectedOuterLocation = new Location("testhost", Location.User, -1, null);
1855+
var expectedOuterLocation = new Location(CliExecutable.ExecutableName, Location.User, -1, null);
18561856
var expectedLocation1 = new Location("Kirk", Location.User, 2, expectedOuterLocation, 7);
18571857
var expectedLocation2 = new Location("Spock", Location.User, 3, expectedOuterLocation, 8);
18581858

src/System.CommandLine.Tests/TokenizerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public void Location_stack_ToString_is_correct()
5656
errors.Should().BeNull();
5757
tokens.Count.Should().Be(3);
5858
locations.Count.Should().Be(2);
59-
locations[0].Should().Be("testhost from User[-1, 8, 0]; --hello from User[0, 7, 0]");
60-
locations[1].Should().Be("testhost from User[-1, 8, 0]; world from User[1, 5, 0]");
59+
locations[0].Should().Be($"{CliExecutable.ExecutableName} from User[-1, {CliExecutable.ExecutableName.Length}, 0]; --hello from User[0, 7, 0]");
60+
locations[1].Should().Be($"{CliExecutable.ExecutableName} from User[-1, {CliExecutable.ExecutableName.Length}, 0]; world from User[1, 5, 0]");
6161
}
6262

6363
[Fact]

0 commit comments

Comments
 (0)