Skip to content

Commit

Permalink
Add test for empty JSON object in version.json file
Browse files Browse the repository at this point in the history
Repros #250
  • Loading branch information
AArnott committed Nov 26, 2018
1 parent 337def8 commit c175dac
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/NerdBank.GitVersioning.Tests/VersionOracleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,14 @@ public void CanUseGitProjectRelativePathWithGitRepoRoot()
oracle = VersionOracle.Create(Path.Combine(this.RepoPath, "otherChildProject"), this.RepoPath, null, null, "otherChildProject");
Assert.Equal("1.1", oracle.MajorMinorVersion.ToString());
}

[Fact]
public void VersionJsonWithoutVersion()
{
File.WriteAllText(Path.Combine(this.RepoPath, VersionFile.JsonFileName), "{}");
this.InitializeSourceControl();
var oracle = VersionOracle.Create(this.RepoPath);
Assert.Equal(0, oracle.Version.Major);
Assert.Equal(0, oracle.Version.Minor);
}
}

0 comments on commit c175dac

Please sign in to comment.