Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Dec 3, 2024
1 parent b133b7e commit fada00e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Elastic.Markdown/Myst/Directives/VersionBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ public override void FinalizeAndValidate(ParserContext context)
if (!SemVersion.TryParse(tokens[0], out var version))
{
var numbers = tokens[0].Split('.', RemoveEmptyEntries);
if (numbers.Length != 2 || !SemVersion.TryParse($"{numbers[0]}.{numbers[1]}", out version))
if (numbers.Length != 2 || !SemVersion.TryParse($"{numbers[0]}.{numbers[1]}.0", out version))
EmitError(context, $"'{tokens[0]}' is not a valid version");
return;
}

Version = version;
Expand Down
5 changes: 4 additions & 1 deletion tests/Elastic.Markdown.Tests/Directives/VersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class VersionDeprectatedTests(ITestOutputHelper output) : VersionTests(ou
public abstract class VersionValidationTests(ITestOutputHelper output, string version) : DirectiveTest<VersionBlock>(output,
$$"""
```{versionchanged} {{version}} more information
Version brief summary
Version brief summary
```
A regular paragraph.
"""
Expand All @@ -64,6 +64,9 @@ public class SimpleVersion(ITestOutputHelper output) : VersionValidationTests(ou
{
[Fact]
public void SetsVersion() => Block!.Version.Should().Be(new SemVersion(7, 17, 0));

[Fact]
public void HasNoError() => Collector.Diagnostics.Should().BeEmpty();
}

public class MajorVersionOnly(ITestOutputHelper output) : VersionValidationTests(output, "8")
Expand Down

0 comments on commit fada00e

Please sign in to comment.