Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc1b070c

Browse files
the-wondersmithoknozor
authored andcommitted
test(ci): add test for configurable changelog omission
1 parent97fd420 commitc1b070c

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

‎tests/cog_tests/changelog.rs‎

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ fn get_changelog_from_tag_to_tagged_head() -> Result<()> {
362362
}
363363

364364
#[sealed_test]
365-
fnget_changelog_whith_custom_template() ->Result<()>{
365+
fnget_changelog_with_custom_template() ->Result<()>{
366366
// Arrange
367367
let crate_dir =env!("CARGO_MANIFEST_DIR");
368368
let template =PathBuf::from(crate_dir).join("tests/cog_tests/template.md");
@@ -437,3 +437,66 @@ fn get_changelog_whith_custom_template() -> Result<()> {
437437
);
438438
Ok(())
439439
}
440+
441+
#[sealed_test]
442+
/// Test that the `omit_from_changelog` configuration
443+
/// directive is honored if/when it is specified for
444+
/// a given commit type.
445+
fnensure_omit_from_changelog_is_honored() ->Result<()>{
446+
// Arrange
447+
git_init()?;
448+
449+
let cog_toml =indoc!(
450+
"[changelog]
451+
remote =\"github.com\"
452+
repository =\"test\"
453+
owner =\"test\"
454+
455+
[commit_types]
456+
wip = { changelog_title =\"Work In Progress\", omit_from_changelog = false }"
457+
);
458+
459+
let _setup =(
460+
run_cmd!(echo $cog_toml > cog.toml;)?,
461+
fs::read_to_string("cog.toml")?,
462+
git_commit("chore: init")?,
463+
git_commit("wip(some-scope): getting there")?,
464+
git_tag("1.0.0")?,
465+
);
466+
467+
let changelog =Command::cargo_bin("cog")?
468+
.arg("changelog")
469+
// Assert
470+
.assert()
471+
.success();
472+
473+
let changelog = changelog.get_output();
474+
let changelog =String::from_utf8_lossy(&changelog.stdout);
475+
476+
assert!(
477+
changelog.as_ref().contains("#### Work In Progress"),
478+
"Expected changelog to contain a\"Work In Progress\" entry but got:\n\n{}",
479+
changelog.as_ref()
480+
);
481+
482+
let cog_toml = cog_toml.replace("omit_from_changelog = false","omit_from_changelog = true");
483+
484+
run_cmd!(echo $cog_toml > cog.toml;)?;
485+
486+
let changelog =Command::cargo_bin("cog")?
487+
.arg("changelog")
488+
// Assert
489+
.assert()
490+
.success();
491+
492+
let changelog = changelog.get_output();
493+
let changelog =String::from_utf8_lossy(&changelog.stdout);
494+
495+
assert!(
496+
!changelog.as_ref().contains("#### Work In Progress"),
497+
"Expected\"Work In Progress\" entry to be omitted from changelog but got:\n\n{}",
498+
changelog.as_ref()
499+
);
500+
501+
Ok(())
502+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp