Skip to content

Commit e2d132e

Browse files
committed
wipp
1 parent 7f8e50e commit e2d132e

File tree

27 files changed

+228
-225
lines changed

27 files changed

+228
-225
lines changed

src/GitVersion.App.Tests/ArgumentParserTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public void UpdateAssemblyInfoWithRelativeFilename()
361361
var targetPath = FileSystemHelper.Path.Combine(repo.RepositoryPath, "subdir1", "subdir2");
362362
this.fileSystem.Directory.CreateDirectory(targetPath);
363363

364-
var arguments = this.argumentParser.ParseArguments($"-targetpath {targetPath} -updateAssemblyInfo ..\\..\\CommonAssemblyInfo.cs");
364+
var arguments = this.argumentParser.ParseArguments($@"-targetpath {targetPath} -updateAssemblyInfo ..\..\CommonAssemblyInfo.cs");
365365
arguments.UpdateAssemblyInfo.ShouldBe(true);
366366
arguments.UpdateAssemblyInfoFileName.Count.ShouldBe(1);
367367
arguments.UpdateAssemblyInfoFileName.ShouldContain(x => FileSystemHelper.Path.GetFileName(x).Equals("CommonAssemblyInfo.cs"));

src/GitVersion.App.Tests/ExecCmdLineArgumentTest.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ public void LogPathContainsForwardSlash()
2525
fixture.MakeATaggedCommit("1.2.3");
2626
fixture.MakeACommit();
2727

28-
var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, @" /l ""/tmp/path""", false);
28+
var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, """
29+
/l "/tmp/path"
30+
""", false);
2931

3032
result.ExitCode.ShouldBe(0);
3133
result.Output.ShouldNotBeNull();
32-
result.Output.ShouldContain(@"""MajorMinorPatch"": ""1.2.4""");
34+
result.Output.ShouldContain("""
35+
"MajorMinorPatch": "1.2.4"
36+
""");
3337
}
3438

3539
[Theory]
@@ -42,7 +46,10 @@ public void CheckBuildServerVerbosityConsole(string verbosityArg, string expecte
4246
fixture.MakeATaggedCommit("1.2.3");
4347
fixture.MakeACommit();
4448

45-
var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, $@" {verbosityArg} -output buildserver /l ""/tmp/path""", false);
49+
var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath,
50+
$"""
51+
{verbosityArg} -output buildserver /l "/tmp/path"
52+
""", false);
4653

4754
result.ExitCode.ShouldBe(0);
4855
result.Output.ShouldNotBeNull();

src/GitVersion.App.Tests/VersionWriterTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void WriteVersionShouldWriteFileVersionWithPrereleaseTag()
4848
private static Assembly GenerateAssembly(Version fileVersion, string prereleaseInfo)
4949
{
5050
var attribute = typeof(AssemblyInformationalVersionAttribute);
51-
var csharpCode = $@"[assembly: {attribute.FullName}(""{fileVersion + prereleaseInfo}"")]";
51+
var csharpCode = $"""[assembly: {attribute.FullName}("{fileVersion + prereleaseInfo}")]""";
5252
var compilation = CSharpCompilation.Create("test-asm")
5353
.WithOptions(new(OutputKind.DynamicallyLinkedLibrary))
5454
.AddReferences(MetadataReference.CreateFromFile(typeof(object).Assembly.Location))

src/GitVersion.BuildAgents/Agents/EnvRun.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace GitVersion.Agents;
77

88
internal class EnvRun(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem)
99
{
10-
public const string EnvironmentVariableName = "ENVRUN_DATABASE";
10+
private const string EnvironmentVariableName = "ENVRUN_DATABASE";
1111
protected override string EnvironmentVariable => EnvironmentVariableName;
1212
public override bool CanApplyToCurrentContext()
1313
{

src/GitVersion.BuildAgents/Agents/TeamCity.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ internal class TeamCity(IEnvironment environment, ILog log, IFileSystem fileSyst
2525
return base.GetCurrentBranch(usingDynamicRepos);
2626
}
2727

28-
private void WriteBranchEnvVariableWarning() => this.Log.Warning(@"TeamCity doesn't make the current branch available through environmental variables.
29-
Depending on your authentication and transport setup of your git VCS root things may work. In that case, ignore this warning.
30-
In your TeamCity build configuration, add a parameter called `env.Git_Branch` with value %teamcity.build.vcs.branch.<vcsid>%
31-
See https://gitversion.net/docs/reference/build-servers/teamcity for more info");
28+
private void WriteBranchEnvVariableWarning() => this.Log.Warning("""
29+
TeamCity doesn't make the current branch available through environmental variables.
30+
Depending on your authentication and transport setup of your git VCS root things may work. In that case, ignore this warning.
31+
In your TeamCity build configuration, add a parameter called `env.Git_Branch` with value %teamcity.build.vcs.branch.<vcsid>%
32+
See https://gitversion.net/docs/reference/build-servers/teamcity for more info
33+
""");
3234

3335
public override bool PreventFetch() => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("Git_Branch"));
3436

src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs

Lines changed: 88 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ public void Setup()
3434
public void OverwritesDefaultsWithProvidedConfig()
3535
{
3636
var defaultConfiguration = this.configurationProvider.ProvideForDirectory(this.repoPath);
37-
const string text = @"
38-
next-version: 2.0.0
39-
branches:
40-
develop:
41-
increment: Major
42-
mode: ContinuousDelivery
43-
label: dev";
37+
const string text = """
38+
next-version: 2.0.0
39+
branches:
40+
develop:
41+
increment: Major
42+
mode: ContinuousDelivery
43+
label: dev
44+
""";
4445
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
4546
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
4647

@@ -89,11 +90,12 @@ public void CanRemoveLabel()
8990
[Test]
9091
public void RegexIsRequired()
9192
{
92-
const string text = @"
93-
next-version: 2.0.0
94-
branches:
95-
bug:
96-
label: bugfix";
93+
const string text = """
94+
next-version: 2.0.0
95+
branches:
96+
bug:
97+
label: bugfix
98+
""";
9799
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
98100
var ex = Should.Throw<ConfigurationException>(() => this.configurationProvider.ProvideForDirectory(this.repoPath));
99101
ex.Message.ShouldBe($"Branch configuration 'bug' is missing required configuration 'regex'{FileSystemHelper.Path.NewLine}" +
@@ -103,12 +105,13 @@ public void RegexIsRequired()
103105
[Test(Description = "This test proves the configuration validation will fail early with a helpful message when a branch listed in source-branches has no configuration.")]
104106
public void SourceBranchesValidationShouldFailWhenMatchingBranchConfigurationIsMissing()
105107
{
106-
const string text = @"
107-
branches:
108-
bug:
109-
regex: 'bug[\/-]'
110-
label: bugfix
111-
source-branches: [notconfigured]";
108+
const string text = """
109+
branches:
110+
bug:
111+
regex: 'bug[\/-]'
112+
label: bugfix
113+
source-branches: [notconfigured]
114+
""";
112115
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
113116
var ex = Should.Throw<ConfigurationException>(() => this.configurationProvider.ProvideForDirectory(this.repoPath));
114117
ex.Message.ShouldBe($"Branch configuration 'bug' defines these 'source-branches' that are not configured: '[notconfigured]'{FileSystemHelper.Path.NewLine}" +
@@ -120,12 +123,13 @@ public void SourceBranchesValidationShouldFailWhenMatchingBranchConfigurationIsM
120123
[TestCase(ConfigurationConstants.DevelopBranchKey)]
121124
public void SourceBranchesValidationShouldSucceedForWellKnownBranches(string wellKnownBranchKey)
122125
{
123-
var text = $@"
124-
branches:
125-
bug:
126-
regex: 'bug[\/-]'
127-
label: bugfix
128-
source-branches: [{wellKnownBranchKey}]";
126+
var text = $"""
127+
branches:
128+
bug:
129+
regex: 'bug[\/-]'
130+
label: bugfix
131+
source-branches: [{wellKnownBranchKey}]
132+
""";
129133
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
130134
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
131135

@@ -135,13 +139,14 @@ public void SourceBranchesValidationShouldSucceedForWellKnownBranches(string wel
135139
[Test]
136140
public void CanProvideConfigForNewBranch()
137141
{
138-
const string text = @"
139-
next-version: 2.0.0
140-
branches:
141-
bug:
142-
regex: 'bug[\/-]'
143-
label: bugfix
144-
source-branches: []";
142+
const string text = """
143+
next-version: 2.0.0
144+
branches:
145+
bug:
146+
regex: 'bug[\/-]'
147+
label: bugfix
148+
source-branches: []
149+
""";
145150
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
146151
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
147152

@@ -191,10 +196,11 @@ public void CanWriteOutEffectiveConfiguration()
191196
[Test]
192197
public void CanUpdateAssemblyInformationalVersioningScheme()
193198
{
194-
const string text = @"
195-
assembly-versioning-scheme: MajorMinor
196-
assembly-file-versioning-scheme: MajorMinorPatch
197-
assembly-informational-format: '{NugetVersion}'";
199+
const string text = """
200+
assembly-versioning-scheme: MajorMinor
201+
assembly-file-versioning-scheme: MajorMinorPatch
202+
assembly-informational-format: '{NugetVersion}'
203+
""";
198204

199205
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
200206

@@ -207,10 +213,11 @@ public void CanUpdateAssemblyInformationalVersioningScheme()
207213
[Test]
208214
public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables()
209215
{
210-
const string text = @"
211-
assembly-versioning-scheme: MajorMinor
212-
assembly-file-versioning-scheme: MajorMinorPatch
213-
assembly-informational-format: '{Major}.{Minor}.{Patch}'";
216+
const string text = """
217+
assembly-versioning-scheme: MajorMinor
218+
assembly-file-versioning-scheme: MajorMinorPatch
219+
assembly-informational-format: '{Major}.{Minor}.{Patch}'
220+
""";
214221

215222
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
216223

@@ -223,12 +230,14 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables(
223230
[Test]
224231
public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer()
225232
{
226-
const string text = @"assembly-versioning-scheme: MajorMinorPatch
227-
assembly-file-versioning-scheme: MajorMinorPatch
228-
assembly-informational-format: '{FullSemVer}'
229-
mode: ContinuousDelivery
230-
next-version: 5.3.0
231-
branches: {}";
233+
const string text = """
234+
assembly-versioning-scheme: MajorMinorPatch
235+
assembly-file-versioning-scheme: MajorMinorPatch
236+
assembly-informational-format: '{FullSemVer}'
237+
mode: ContinuousDelivery
238+
next-version: 5.3.0
239+
branches: {}
240+
""";
232241

233242
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
234243

@@ -297,13 +306,14 @@ public void NoWarnOnGitVersionYmlFile()
297306
[Test]
298307
public void ShouldUseSpecifiedSourceBranchesForDevelop()
299308
{
300-
const string text = @"
301-
next-version: 2.0.0
302-
branches:
303-
develop:
304-
mode: ContinuousDeployment
305-
source-branches: ['develop']
306-
label: dev";
309+
const string text = """
310+
next-version: 2.0.0
311+
branches:
312+
develop:
313+
mode: ContinuousDeployment
314+
source-branches: ['develop']
315+
label: dev
316+
""";
307317
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
308318
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
309319

@@ -313,12 +323,13 @@ public void ShouldUseSpecifiedSourceBranchesForDevelop()
313323
[Test]
314324
public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForDevelop()
315325
{
316-
const string text = @"
317-
next-version: 2.0.0
318-
branches:
319-
develop:
320-
mode: ContinuousDeployment
321-
label: dev";
326+
const string text = """
327+
next-version: 2.0.0
328+
branches:
329+
develop:
330+
mode: ContinuousDeployment
331+
label: dev
332+
""";
322333
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
323334
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
324335

@@ -328,13 +339,14 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForDevelop()
328339
[Test]
329340
public void ShouldUseSpecifiedSourceBranchesForFeature()
330341
{
331-
const string text = @"
332-
next-version: 2.0.0
333-
branches:
334-
feature:
335-
mode: ContinuousDeployment
336-
source-branches: ['develop', 'release']
337-
label: dev";
342+
const string text = """
343+
next-version: 2.0.0
344+
branches:
345+
feature:
346+
mode: ContinuousDeployment
347+
source-branches: ['develop', 'release']
348+
label: dev
349+
""";
338350
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
339351
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
340352

@@ -344,12 +356,13 @@ public void ShouldUseSpecifiedSourceBranchesForFeature()
344356
[Test]
345357
public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature()
346358
{
347-
const string text = @"
348-
next-version: 2.0.0
349-
branches:
350-
feature:
351-
mode: ContinuousDeployment
352-
label: dev";
359+
const string text = """
360+
next-version: 2.0.0
361+
branches:
362+
feature:
363+
mode: ContinuousDeployment
364+
label: dev
365+
""";
353366
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
354367
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
355368

@@ -360,9 +373,10 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature()
360373
[Test]
361374
public void ShouldNotOverrideAnythingWhenOverrideConfigIsEmpty()
362375
{
363-
const string text = @"
364-
next-version: 1.2.3
365-
tag-prefix: custom-tag-prefix-from-yml";
376+
const string text = """
377+
next-version: 1.2.3
378+
tag-prefix: custom-tag-prefix-from-yml
379+
""";
366380
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
367381

368382
var expectedConfig = GitFlowConfigurationBuilder.New

0 commit comments

Comments
 (0)