-
Notifications
You must be signed in to change notification settings - Fork 662
Expand file tree
/
Copy pathBackwardCompatibilityTests.cs
More file actions
35 lines (27 loc) · 1.06 KB
/
BackwardCompatibilityTests.cs
File metadata and controls
35 lines (27 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace GitVersion.Core.Tests.Formatting;
[TestFixture]
public class LegacyRegexPatternTests
{
[Test]
public void ExpandTokensRegex_ShouldParseLegacySemicolonSyntax()
{
const string input = "{CommitsSinceVersionSource:0000;;''}";
var matches = RegexPatterns.Common.ExpandTokensRegex().Matches(input);
matches.Count.ShouldBe(1);
var match = matches[0];
match.Groups["member"].Value.ShouldBe("CommitsSinceVersionSource");
match.Groups["format"].Success.ShouldBeTrue();
}
[Test]
public void ExpandTokensRegex_ShouldHandleMixedSyntax()
{
const string input = "{NewStyle:0000 ?? 'fallback'} {OldStyle:pos;neg;zero}";
var matches = RegexPatterns.Common.ExpandTokensRegex().Matches(input);
matches.Count.ShouldBe(2);
var newMatch = matches[0];
newMatch.Groups["member"].Value.ShouldBe("NewStyle");
newMatch.Groups["fallback"].Value.ShouldBe("fallback");
var oldMatch = matches[1];
oldMatch.Groups["member"].Value.ShouldBe("OldStyle");
}
}