Skip to content

Commit c175dac

Browse files
committed
Add test for empty JSON object in version.json file
Repros #250
1 parent 337def8 commit c175dac

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/NerdBank.GitVersioning.Tests/VersionOracleTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,14 @@ public void CanUseGitProjectRelativePathWithGitRepoRoot()
279279
oracle = VersionOracle.Create(Path.Combine(this.RepoPath, "otherChildProject"), this.RepoPath, null, null, "otherChildProject");
280280
Assert.Equal("1.1", oracle.MajorMinorVersion.ToString());
281281
}
282+
283+
[Fact]
284+
public void VersionJsonWithoutVersion()
285+
{
286+
File.WriteAllText(Path.Combine(this.RepoPath, VersionFile.JsonFileName), "{}");
287+
this.InitializeSourceControl();
288+
var oracle = VersionOracle.Create(this.RepoPath);
289+
Assert.Equal(0, oracle.Version.Major);
290+
Assert.Equal(0, oracle.Version.Minor);
291+
}
282292
}

0 commit comments

Comments
 (0)