chore(go): add unreleased changelog tests
This commit is contained in:
@@ -23,6 +23,19 @@ func TestMainRecommendPrintsTag(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMainPrintUnreleasedWritesPendingNotes(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
writeFile(t, filepath.Join(root, "CHANGELOG.md"), "# Changelog\n\n## [Unreleased]\n\n### Added\n\n- Feature.\n\n### Fixed\n\n- Bugfix.\n\n## [1.1.6] - 2017-12-20\n")
|
||||
|
||||
stdout, stderr, code := runMain(t, "--print-unreleased", "--root", root)
|
||||
if code != 0 {
|
||||
t.Fatalf("expected exit 0, got %d (stderr: %s)", code, stderr)
|
||||
}
|
||||
if stdout != "### Added\n\n- Feature.\n\n### Fixed\n\n- Bugfix.\n" {
|
||||
t.Fatalf("unexpected unreleased output: %q", stdout)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMainUsageExitWhenRequiredFlagsMissing(t *testing.T) {
|
||||
_, stderr, code := runMain(t)
|
||||
if code != 2 {
|
||||
|
||||
Reference in New Issue
Block a user