Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jellllly420 committed May 1, 2023
1 parent ff6cd17 commit 5eb3cef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
12 changes: 6 additions & 6 deletions tools/changelog/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ impl Cli {
let (breaking_changes, filtered_log_lines): (Vec<_>, Vec<_>) = log_lines
.into_iter()
.partition(|log_line| log_line.is_breaking_change);

let (fixes, features): (Vec<_>, Vec<_>) = filtered_log_lines
.into_iter()
.partition(|filtered_log_line| filtered_log_line.message.to_lowercase().contains("fix"));

let (fixes, features): (Vec<_>, Vec<_>) =
filtered_log_lines
.into_iter()
.partition(|filtered_log_line| filtered_log_line.message.to_lowercase().contains("fix"));

// create displayable log lines
let fixes_logs = write_log_lines(fixes)?;
Expand All @@ -96,8 +97,7 @@ impl Cli {

if !skip_file_write {
// create version changelog
let version_changelog =
write_changelog_file(&fixes_logs, &features_logs, &breaking_changes_logs, package, next_version)?;
let version_changelog = write_changelog_file(&fixes_logs, &features_logs, &breaking_changes_logs, package, next_version)?;

// write changelog
write_changelog(&changelog_path, &version_changelog)?;
Expand Down
15 changes: 4 additions & 11 deletions tools/changelog/tests/generate_yew_changelog_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,13 @@ fn generate_yew_changelog_file() -> Result<()> {
let lines = expected_reader_lines.zip(after_reader_lines);

for (i, (expected_line, after_line)) in lines.enumerate() {
if i == 2 {
// third line has dynamic things that may break the tests
let expected_third_line = expected_line?.replace(
if i == 2 || i == 13 {
// third and thirteenth line has dynamic things that may break the tests
let expected_line_updated = expected_line?.replace(
"date_goes_here",
Utc::now().format("%Y-%m-%d").to_string().as_str(),
);
assert_eq!(expected_third_line, after_line?);
} else if i == 13 {
// thirteenth line has dynamic things that may break the tests
let expected_thirteenth_line = expected_line?.replace(
"date_goes_here",
Utc::now().format("%Y-%m-%d").to_string().as_str(),
);
assert_eq!(expected_thirteenth_line, after_line?);
assert_eq!(expected_line_updated, after_line?);
} else {
assert_eq!(expected_line?, after_line?);
}
Expand Down

0 comments on commit 5eb3cef

Please sign in to comment.