Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test coverage gaps found by cargo mutants #230

Open
mgeisler opened this issue Sep 12, 2024 · 0 comments
Open

Test coverage gaps found by cargo mutants #230

mgeisler opened this issue Sep 12, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@mgeisler
Copy link
Collaborator

I ran cargo mutants on the code and it found a few potential things we can look into.

For each of these changes, cargo test passes both before and after, suggesting that we should add more unit tests to catch these changes in behavior:

i18n-report/src/main.rs:91:5: replace all_stats -> anyhow::Result<Vec<MessageStats>> with Ok(vec![])
i18n-helpers/src/lib.rs:821:59: replace && with || in translate_events
i18n-report/src/stats.rs:37:13: replace + with * in MessageStats::total
i18n-helpers/src/bin/mdbook-gettext.rs:38:8: delete ! in preprocess
i18n-helpers/src/bin/mdbook-xgettext.rs:30:5: replace main -> anyhow::Result<()> with Ok(())
i18n-helpers/src/lib.rs:510:49: replace + with - in parse_codeblock
i18n-helpers/src/bin/mdbook-gettext.rs:56:31: replace == with != in main
i18n-report/src/main.rs:166:34: replace == with != in po_files
i18n-helpers/src/lib.rs:429:5: replace is_codeblock_group -> bool with true
i18n-report/src/stats.rs:95:44: replace += with *= in MessageStats::for_catalog
i18n-report/src/main.rs:108:5: replace diff -> anyhow::Result<()> with Ok(())
i18n-helpers/src/preprocessors/gettext.rs:72:9: replace <impl Preprocessor for Gettext>::name -> &str with ""
i18n-report/src/stats.rs:69:20: replace * with / in MessageStats::to_context
i18n-helpers/src/gettext.rs:80:5: replace translate_book with ()
i18n-helpers/src/preprocessors/gettext.rs:41:5: replace get_catalog_path -> anyhow::Result<PathBuf> with Ok(Default::default())
i18n-helpers/src/normalize.rs:225:69: replace - with / in normalize
i18n-helpers/src/normalize.rs:166:75: replace > with < in SourceMap<'a>::extract_messages
i18n-report/src/stats.rs:65:20: replace * with + in MessageStats::to_context
i18n-report/src/stats.rs:65:20: replace * with / in MessageStats::to_context
i18n-report/src/stats.rs:69:55: replace / with % in MessageStats::to_context
i18n-helpers/src/bin/mdbook-gettext.rs:56:5: replace main -> anyhow::Result<()> with Ok(())
i18n-report/src/stats.rs:98:50: replace += with *= in MessageStats::for_catalog
i18n-helpers/src/normalize.rs:16:5: replace parse_source -> Option<(&str, usize)> with Some(("", 1))
i18n-report/src/stats.rs:73:65: replace / with % in MessageStats::to_context
i18n-report/src/stats.rs:109:9: replace <impl Display for MessageStats>::fmt -> fmt::Result with Ok(Default::default())
i18n-helpers/src/normalize.rs:29:5: replace compute_source -> String with "xyzzy".into()
i18n-helpers/src/lib.rs:577:49: replace + with - in parse_codeblock
i18n-report/src/stats.rs:44:9: replace MessageStats::to_context -> BTreeMap<String, Value> with BTreeMap::from_iter([(String::new(), Default::default())])
i18n-helpers/src/preprocessors/gettext.rs:80:9: replace <impl Preprocessor for Gettext>::run -> anyhow::Result<mdbook::book::Book> with Ok(Default::default())
i18n-helpers/src/lib.rs:510:49: replace + with * in parse_codeblock
i18n-report/src/stats.rs:93:50: replace += with *= in MessageStats::for_catalog
i18n-report/src/stats.rs:44:9: replace MessageStats::to_context -> BTreeMap<String, Value> with BTreeMap::from_iter([("xyzzy".into(), Default::default())])
i18n-report/src/stats.rs:37:13: replace + with - in MessageStats::total
i18n-report/src/stats.rs:38:13: replace + with * in MessageStats::total
i18n-report/src/stats.rs:69:20: replace * with + in MessageStats::to_context
i18n-helpers/src/bin/mdbook-i18n-normalize.rs:20:5: replace main -> anyhow::Result<()> with Ok(())
i18n-report/src/stats.rs:93:50: replace += with -= in MessageStats::for_catalog
i18n-report/src/stats.rs:73:65: replace / with * in MessageStats::to_context
i18n-report/src/stats.rs:69:55: replace / with * in MessageStats::to_context
i18n-report/src/main.rs:91:5: replace all_stats -> anyhow::Result<Vec<MessageStats>> with Ok(vec![Default::default()])
i18n-report/src/stats.rs:73:20: replace * with + in MessageStats::to_context
i18n-helpers/src/preprocessors/gettext.rs:29:5: replace should_translate -> bool with false
i18n-report/src/stats.rs:39:13: replace + with - in MessageStats::total
i18n-report/src/stats.rs:65:59: replace / with % in MessageStats::to_context
i18n-report/src/main.rs:159:5: replace po_files -> anyhow::Result<Vec<PathBuf>> with Ok(vec![])
i18n-report/src/stats.rs:77:61: replace / with * in MessageStats::to_context
i18n-report/src/stats.rs:77:61: replace / with % in MessageStats::to_context
i18n-helpers/src/normalize.rs:16:5: replace parse_source -> Option<(&str, usize)> with Some(("", 0))
i18n-helpers/src/normalize.rs:16:5: replace parse_source -> Option<(&str, usize)> with Some(("xyzzy", 1))
i18n-report/src/stats.rs:36:9: replace MessageStats::total -> u32 with 1
i18n-report/src/stats.rs:39:13: replace + with * in MessageStats::total
i18n-report/src/stats.rs:98:50: replace += with -= in MessageStats::for_catalog
i18n-helpers/src/normalize.rs:49:5: replace has_broken_link -> bool with true
mdbook-tera-backend/src/main.rs:13:5: replace main -> anyhow::Result<()> with Ok(())
i18n-helpers/src/lib.rs:577:49: replace + with * in parse_codeblock
i18n-helpers/src/lib.rs:191:9: replace GroupingContext::clear_skip_next_group -> Self with Default::default()
i18n-helpers/src/normalize.rs:32:12: delete ! in compute_source
i18n-report/src/stats.rs:95:44: replace += with -= in MessageStats::for_catalog
i18n-helpers/src/preprocessors/gettext.rs:89:9: replace <impl Preprocessor for Gettext>::supports_renderer -> bool with true
i18n-report/src/stats.rs:77:20: replace * with + in MessageStats::to_context
i18n-helpers/src/preprocessors/gettext.rs:72:9: replace <impl Preprocessor for Gettext>::name -> &str with "xyzzy"
i18n-helpers/src/preprocessors/gettext.rs:89:18: replace != with == in <impl Preprocessor for Gettext>::supports_renderer
i18n-helpers/src/bin/mdbook-gettext.rs:34:5: replace preprocess -> anyhow::Result<()> with Ok(())
i18n-helpers/src/normalize.rs:29:5: replace compute_source -> String with String::new()
i18n-helpers/src/xgettext.rs:327:34: replace == with != in slug
i18n-report/src/stats.rs:100:44: replace += with -= in MessageStats::for_catalog
i18n-helpers/src/preprocessors/gettext.rs:89:9: replace <impl Preprocessor for Gettext>::supports_renderer -> bool with false
i18n-helpers/src/normalize.rs:16:5: replace parse_source -> Option<(&str, usize)> with Some(("xyzzy", 0))
i18n-report/src/stats.rs:38:13: replace + with - in MessageStats::total
i18n-report/src/stats.rs:73:20: replace * with / in MessageStats::to_context
i18n-report/src/stats.rs:77:20: replace * with / in MessageStats::to_context
i18n-report/src/main.rs:159:5: replace po_files -> anyhow::Result<Vec<PathBuf>> with Ok(vec![Default::default()])
i18n-report/src/main.rs:144:34: replace != with == in diff
i18n-report/src/stats.rs:85:9: replace MessageStats::for_catalog -> Self with Default::default()
i18n-helpers/src/preprocessors/gettext.rs:29:5: replace should_translate -> bool with true
i18n-helpers/src/normalize.rs:225:69: replace - with + in normalize
i18n-report/src/stats.rs:44:9: replace MessageStats::to_context -> BTreeMap<String, Value> with BTreeMap::new()
i18n-report/src/stats.rs:100:44: replace += with *= in MessageStats::for_catalog
i18n-report/src/main.rs:33:5: replace main -> anyhow::Result<()> with Ok(())
i18n-report/src/main.rs:113:25: replace == with != in diff
i18n-report/src/stats.rs:65:59: replace / with * in MessageStats::to_context
i18n-report/src/main.rs:73:5: replace report -> anyhow::Result<()> with Ok(())
i18n-helpers/src/lib.rs:570:20: delete ! in parse_codeblock
i18n-report/src/stats.rs:36:9: replace MessageStats::total -> u32 with 0
@mgeisler mgeisler added the good first issue Good for newcomers label Sep 12, 2024
@mgeisler mgeisler changed the title Potential bugs found by cargo mutants Test coverage gaps found by cargo mutants Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant