diff --git a/DESIGN.md b/DESIGN.md index 2258e03c..09273e7b 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -47,8 +47,8 @@ applied. `source.rs` -- A source tree and files within it, including visiting each source file to find mutations. -`textedit.rs` -- A (line, column) addressing within a source file, and edits to -the content based on those addresses. +`span.rs` -- A (line, column) addressing within a source file, a range between +two positions, and edits to the content based on those addresses. `visit.rs` -- Walk a source file's AST, and guess at likely-legal-but-wrong replacements. The interface to the `syn` parser is localized here, and also the diff --git a/NEWS.md b/NEWS.md index d230938d..51e6de99 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,16 @@ ## 23.11.2 +A big internal refactor to allow mutations smaller than a whole function. Only one pattern is added in this release, mutation of `==` operators, but many more are possible. + +- New: Mutate `==` to `!=` and vice versa. + +- Changed: Include column numbers in text listings of mutants and output to disambiguate smaller-than-function mutants, for example if there are several operators that can be changed on one line. This also applies to the names used for regex matching, so may break some regexps that match the entire line (sorry). The new option `--line-col=false` turns them both off in `--list` output. + +- Changed: Replaced the `function`, `line`, and `return_type` fields in the mutants json message with a `function` submessage (including the name and return type) and a `span` indicating the entire replaced region. + +## 23.11.2 + - Changed: If `--file` or `--exclude` are set on the command line, then they replace the corresponding config file options. Similarly, if `--re` is given then the `examine_re` config key is ignored, and if `--exclude-re` is given then `exclude_regex` is ignored. (Previously the values were combined.) This makes it easier to use the command line to test files or mutants that are normally not tested. - Improved: By default, files matching gitignore patterns (including in parent directories, per-user configuration, and `info/exclude`) are excluded from copying to temporary build directories. This should improve performance in some large trees with many files that are not part of the build. This behavior can be turned off with `--gitignore=false`. @@ -12,6 +22,8 @@ - Added: Accept `--manifest-path` as an alternative to `-d`, for consistency with other cargo commands. +- Changed: The json mutants format now includes a `function` sub-message, which includes the function name and return type, rather than them being direct attributes of the mutant, to better accomodate smaller-than-function mutants. Also, the `function` includes the line-column span of the entire function. + ## 23.11.1 - New `--in-diff FILE` option tests only mutants that are in the diff from the diff --git a/book/src/mutants.md b/book/src/mutants.md index b492b19f..b49fd42d 100644 --- a/book/src/mutants.md +++ b/book/src/mutants.md @@ -4,8 +4,12 @@ cargo mutants generates mutants by inspecting the existing source code and applying a set of rules to generate new code that is likely to compile but have different behavior. -Mutants each have a "genre". In the current release, the only mutation genre is -`FnValue`, where a function's body is replaced with a value of the same type. +Mutants each have a "genre", each of which is described below. + +## Replace function body with value + +The `FnValue` genre of mutants replaces a function's body with a value that is guessed to be of the right type. + This checks that the tests: 1. Observe any side effects of the original function. @@ -50,3 +54,17 @@ Some of these values may not be valid for all types: for example, returning `Default::default()` will work for many types, but not all. In this case the mutant is said to be "unviable": by default these are counted but not printed, although they can be shown with `--unviable`. + +## Binary operators + +Binary operators are replaced with other binary operators in expressions +like `a == 0`. + +| Operator | Replacements | Description | +| -------- | ------------ | ----------- | +| `==` | `!=` | Equality | +| `!=` | `==` | Equality | + +Equality operators are not currently replaced with comparisons like `<` or `<=` +because they are +too prone to generate false positives, for example when unsigned integers are compared to 0. diff --git a/src/console.rs b/src/console.rs index ff617332..0656137f 100644 --- a/src/console.rs +++ b/src/console.rs @@ -101,7 +101,7 @@ impl Console { write!( s, "{} ... {}", - style_scenario(scenario), + style_scenario(scenario, true), style_outcome(outcome) ) .unwrap(); @@ -493,7 +493,7 @@ impl ScenarioModel { fn new(scenario: &Scenario, start: Instant, log_file: Utf8PathBuf) -> ScenarioModel { ScenarioModel { scenario: scenario.clone(), - name: style_scenario(scenario), + name: style_scenario(scenario, true), phase: None, phase_start: start, log_file, @@ -591,28 +591,6 @@ pub fn style_outcome(outcome: &ScenarioOutcome) -> StyledObject<&'static str> { } } -pub(crate) fn style_mutant(mutant: &Mutant) -> String { - // This is like `impl Display for Mutant`, but with colors. - // The text content should be the same. - let mut s = String::with_capacity(200); - write!( - &mut s, - "{}:{}", - mutant.source_file.tree_relative_slashes(), - mutant.span.start.line, - ) - .unwrap(); - s.push_str(": replace "); - s.push_str(&style(mutant.function_name()).bright().magenta().to_string()); - if !mutant.return_type().is_empty() { - s.push(' '); - s.push_str(&style(mutant.return_type()).magenta().to_string()); - } - s.push_str(" with "); - s.push_str(&style(mutant.replacement_text()).yellow().to_string()); - s -} - fn style_elapsed_secs(since: Instant) -> String { style_secs(since.elapsed()) } @@ -640,10 +618,10 @@ fn style_mb(bytes: u64) -> StyledObject { style(format_mb(bytes)).cyan() } -pub fn style_scenario(scenario: &Scenario) -> Cow<'static, str> { +pub fn style_scenario(scenario: &Scenario, line_col: bool) -> Cow<'static, str> { match scenario { Scenario::Baseline => "Unmutated baseline".into(), - Scenario::Mutant(mutant) => style_mutant(mutant).into(), + Scenario::Mutant(mutant) => mutant.name(line_col, true).into(), } } diff --git a/src/in_diff.rs b/src/in_diff.rs index f90c40f2..62a8f2ec 100644 --- a/src/in_diff.rs +++ b/src/in_diff.rs @@ -49,8 +49,8 @@ pub fn diff_filter(mutants: Vec, diff_text: &str) -> Result> trace!( ?path, line, - %mutant, - "diff matched mutant" + mutant = mutant.name(true, false), + "diff matched mutant" ); matched.push(mutant); continue 'mutant; diff --git a/src/list.rs b/src/list.rs index 80246121..58ef71c9 100644 --- a/src/list.rs +++ b/src/list.rs @@ -8,7 +8,6 @@ use std::sync::Arc; use serde_json::{json, Value}; -use crate::console::style_mutant; use crate::mutate::Mutant; use crate::path::Utf8PathSlashes; use crate::source::SourceFile; @@ -48,11 +47,11 @@ pub(crate) fn list_mutants( out.write_str(&serde_json::to_string_pretty(&list)?)?; } else { for mutant in mutants { - if options.colors { - writeln!(out, "{}", style_mutant(mutant))?; - } else { - writeln!(out, "{}", mutant)?; - } + writeln!( + out, + "{}", + mutant.name(options.show_line_col, options.colors) + )?; if options.emit_diffs { writeln!(out, "{}", mutant.diff())?; } diff --git a/src/main.rs b/src/main.rs index f01b2776..34ad2ae4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,7 @@ mod pretty; mod process; mod scenario; mod source; -mod textedit; +mod span; mod visit; mod workspace; @@ -62,6 +62,9 @@ use crate::workspace::{PackageFilter, Workspace}; const VERSION: &str = env!("CARGO_PKG_VERSION"); const NAME: &str = env!("CARGO_PKG_NAME"); +/// A comment marker inserted next to changes, so they can be easily found. +static MUTATION_MARKER_COMMENT: &str = "/* ~ changed by cargo-mutants ~ */"; + #[derive(Parser)] #[command(name = "cargo", bin_name = "cargo")] enum Cargo { @@ -177,6 +180,10 @@ struct Args { #[arg(long)] no_times: bool, + /// include line & column numbers in the mutation list. + #[arg(long, action = ArgAction::Set, default_value = "true")] + line_col: bool, + /// create mutants.out within this directory. #[arg(long, short = 'o')] output: Option, diff --git a/src/mutate.rs b/src/mutate.rs index 2cb2737e..822114bc 100644 --- a/src/mutate.rs +++ b/src/mutate.rs @@ -7,6 +7,7 @@ use std::fs; use std::sync::Arc; use anyhow::{ensure, Context, Result}; +use console::{style, StyledObject}; use serde::ser::{SerializeStruct, Serializer}; use serde::Serialize; use similar::TextDiff; @@ -14,16 +15,16 @@ use similar::TextDiff; use crate::build_dir::BuildDir; use crate::package::Package; use crate::source::SourceFile; -use crate::textedit::{replace_region, Span}; - -/// A comment marker inserted next to changes, so they can be easily found. -const MUTATION_MARKER_COMMENT: &str = "/* ~ changed by cargo-mutants ~ */"; +use crate::span::Span; +use crate::MUTATION_MARKER_COMMENT; /// Various broad categories of mutants. #[derive(Clone, Eq, PartialEq, Debug, Serialize)] pub enum Genre { /// Replace the body of a function with a fixed value. FnValue, + /// Replace `==` with `!=` and so on. + BinaryOperator, } /// A mutation applied to source code. @@ -32,13 +33,14 @@ pub struct Mutant { /// Which file is being mutated. pub source_file: Arc, - /// The function that's being mutated. - pub function_name: Arc, - - /// The return type of the function, as a fragment of Rust syntax. - pub return_type: Arc, + /// The function that's being mutated: the nearest enclosing function, if they are nested. + /// + /// There may be none for mutants in e.g. top-level const expressions. + pub function: Option>, /// The mutated textual region. + /// + /// This is deleted and replaced with the replacement text. pub span: Span, /// The replacement text. @@ -48,41 +50,100 @@ pub struct Mutant { pub genre: Genre, } +/// The function containing a mutant. +/// +/// This is used for both mutations of the whole function, and smaller mutations within it. +#[derive(Eq, PartialEq, Debug, Serialize)] +pub struct Function { + /// The function that's being mutated. + pub function_name: String, + + /// The return type of the function, including a leading "-> ", as a fragment of Rust syntax. + /// + /// Empty if the function has no return type (i.e. returns `()`). + pub return_type: String, + + /// The span (line/column range) of the entire function. + pub span: Span, +} + impl Mutant { /// Return text of the whole file with the mutation applied. pub fn mutated_code(&self) -> String { - replace_region( + self.span.replace( &self.source_file.code, - &self.span.start, - &self.span.end, - &format!("{{\n{} {}\n}}\n", self.replacement, MUTATION_MARKER_COMMENT), + &format!("{} {}", &self.replacement, MUTATION_MARKER_COMMENT), ) } - /// Return the original code for the entire file affected by this mutation. - pub fn original_code(&self) -> &str { - &self.source_file.code - } - - pub fn return_type(&self) -> &str { - &self.return_type - } - /// Describe the mutant briefly, not including the location. /// /// The result is like `replace factorial -> u32 with Default::default()`. pub fn describe_change(&self) -> String { - format!( - "replace {name}{space}{type} with {replacement}", - name = self.function_name(), - space = if self.return_type.is_empty() { - "" - } else { - " " - }, - type = self.return_type(), - replacement = self.replacement - ) + self.styled_parts() + .into_iter() + .map(|x| x.force_styling(false).to_string()) + .collect::>() + .join("") + } + + pub fn name(&self, show_line_col: bool, styled: bool) -> String { + let mut v = Vec::new(); + v.push(self.source_file.tree_relative_slashes()); + if show_line_col { + v.push(format!( + ":{}:{}", + self.span.start.line, self.span.start.column + )); + } + v.push(": ".to_owned()); + let parts = self.styled_parts(); + if styled { + v.extend(parts.into_iter().map(|x| x.to_string())); + } else { + v.extend( + parts + .into_iter() + .map(|x| x.force_styling(false).to_string()), + ); + } + v.join("") + } + + fn styled_parts(&self) -> Vec> { + // This is like `impl Display for Mutant`, but with colors. + // The text content should be the same. + fn s(s: S) -> StyledObject { + style(s.to_string()) + } + let mut v: Vec> = Vec::new(); + v.push(s("replace ")); + if self.genre != Genre::FnValue { + v.push(s(self.original_text()).yellow()); + v.push(s(" with ")); + v.push(s(&self.replacement).bright().yellow()); + v.push(s(" in ")); + } + if let Some(function) = &self.function { + v.push(s(&function.function_name).bright().magenta()); + } else { + v.push(s("module")); + } + if self.genre == Genre::FnValue { + if let Some(function) = &self.function { + if !function.return_type.is_empty() { + v.push(s(" ")); + v.push(s(&function.return_type).magenta()); + } + } + v.push(s(" with ")); + v.push(s(self.replacement_text()).yellow()); + } + v + } + + pub fn original_text(&self) -> String { + self.span.extract(&self.source_file.code) } /// Return the text inserted for this mutation. @@ -90,14 +151,6 @@ impl Mutant { self.replacement.as_str() } - /// Return the name of the function to be mutated. - /// - /// Note that this will often not be unique: the same name can be reused - /// in different modules, under different cfg guards, etc. - pub fn function_name(&self) -> &str { - &self.function_name - } - /// Return the cargo package name. pub fn package_name(&self) -> &str { &self.source_file.package.name @@ -112,7 +165,7 @@ impl Mutant { let old_label = self.source_file.tree_relative_slashes(); // There shouldn't be any newlines, but just in case... let new_label = self.describe_change().replace('\n', " "); - TextDiff::from_lines(self.original_code(), &self.mutated_code()) + TextDiff::from_lines(&self.source_file.code, &self.mutated_code()) .unified_diff() .context_radius(8) .header(&old_label, &new_label) @@ -125,7 +178,7 @@ impl Mutant { } pub fn unapply(&self, build_dir: &mut BuildDir) -> Result<()> { - self.write_in_dir(build_dir, self.original_code()) + self.write_in_dir(build_dir, &self.source_file.code) } #[allow(unknown_lints, clippy::needless_pass_by_ref_mut)] @@ -142,7 +195,7 @@ impl Mutant { format!( "{}_line_{}", self.source_file.tree_relative_slashes(), - self.span.start.line + self.span.start.line, ) } } @@ -151,34 +204,15 @@ impl fmt::Debug for Mutant { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // Custom implementation to show spans more concisely f.debug_struct("Mutant") - .field("function_name", &self.function_name()) - .field("return_type", &self.return_type) + .field("function", &self.function) .field("replacement", &self.replacement) .field("genre", &self.genre) - .field("start", &(self.span.start.line, self.span.start.column)) - .field("end", &(self.span.end.line, self.span.end.column)) + .field("span", &self.span) .field("package_name", &self.package_name()) .finish() } } -impl fmt::Display for Mutant { - /// Describe this mutant like a compiler error message, starting with the file and line. - /// - /// The result is like `src/source.rs:123: replace source::SourceFile::new with Default::default()`. - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // This is like `style_mutant`, but without colors. - // The text content should be the same. - write!( - f, - "{file}:{line}: {change}", - file = self.source_file.tree_relative_slashes(), - line = self.span.start.line, - change = self.describe_change() - ) - } -} - impl Serialize for Mutant { fn serialize(&self, serializer: S) -> Result where @@ -188,9 +222,8 @@ impl Serialize for Mutant { let mut ss = serializer.serialize_struct("Mutant", 7)?; ss.serialize_field("package", &self.package_name())?; ss.serialize_field("file", &self.source_file.tree_relative_slashes())?; - ss.serialize_field("line", &self.span.start.line)?; - ss.serialize_field("function", &self.function_name.as_ref())?; - ss.serialize_field("return_type", &self.return_type.as_ref())?; + ss.serialize_field("function", &self.function.as_ref().map(|a| a.as_ref()))?; + ss.serialize_field("span", &self.span)?; ss.serialize_field("replacement", &self.replacement)?; ss.serialize_field("genre", &self.genre)?; ss.end() @@ -216,47 +249,56 @@ mod test { .unwrap(); assert_eq!(mutants.len(), 3); assert_eq!( - format!("{:?}", mutants[0]), - "Mutant { \ - function_name: \"main\", \ - return_type: \"\", \ - replacement: \"()\", \ - genre: FnValue, \ - start: (1, 11), end: (5, 2), \ - package_name: \"cargo-mutants-testdata-factorial\" \ - }" + format!("{:#?}", mutants[0]), + indoc! { + r#"Mutant { + function: Some( + Function { + function_name: "main", + return_type: "", + span: Span(1, 1, 5, 2), + }, + ), + replacement: "()", + genre: FnValue, + span: Span(2, 5, 4, 6), + package_name: "cargo-mutants-testdata-factorial", + }"# + } ); assert_eq!( - mutants[0].to_string(), - "src/bin/factorial.rs:1: replace main with ()" + mutants[0].name(true, false), + "src/bin/factorial.rs:2:5: replace main with ()" ); assert_eq!( format!("{:#?}", mutants[1]), indoc! { r#" Mutant { - function_name: "factorial", - return_type: "-> u32", + function: Some( + Function { + function_name: "factorial", + return_type: "-> u32", + span: Span(7, 1, 13, 2), + }, + ), replacement: "0", genre: FnValue, - start: ( - 7, - 29, - ), - end: ( - 13, - 2, - ), + span: Span(8, 5, 12, 6), package_name: "cargo-mutants-testdata-factorial", }"# } ); assert_eq!( - mutants[1].to_string(), - "src/bin/factorial.rs:7: replace factorial -> u32 with 0" + mutants[1].name(false, false), + "src/bin/factorial.rs: replace factorial -> u32 with 0" ); assert_eq!( - mutants[2].to_string(), - "src/bin/factorial.rs:7: replace factorial -> u32 with 1" + mutants[1].name(true, false), + "src/bin/factorial.rs:8:5: replace factorial -> u32 with 0" + ); + assert_eq!( + mutants[2].name(true, false), + "src/bin/factorial.rs:8:5: replace factorial -> u32 with 1" ); } @@ -283,14 +325,13 @@ mod test { )?; assert_eq!(mutants.len(), 3); - let mut mutated_code = mutants[0].mutated_code(); - assert_eq!(mutants[0].function_name(), "main"); - mutated_code.retain(|c| c != '\r'); + let mutated_code = mutants[0].mutated_code(); + assert_eq!(mutants[0].function.as_ref().unwrap().function_name, "main"); assert_eq!( - mutated_code, + strip_trailing_space(&mutated_code), indoc! { r#" fn main() { - () /* ~ changed by cargo-mutants ~ */ + () /* ~ changed by cargo-mutants ~ */ } fn factorial(n: u32) -> u32 { @@ -310,11 +351,13 @@ mod test { } ); - let mut mutated_code = mutants[1].mutated_code(); - assert_eq!(mutants[1].function_name(), "factorial"); - mutated_code.retain(|c| c != '\r'); + let mutated_code = mutants[1].mutated_code(); + assert_eq!( + mutants[1].function.as_ref().unwrap().function_name, + "factorial" + ); assert_eq!( - mutated_code, + strip_trailing_space(&mutated_code), indoc! { r#" fn main() { for i in 1..=6 { @@ -323,7 +366,7 @@ mod test { } fn factorial(n: u32) -> u32 { - 0 /* ~ changed by cargo-mutants ~ */ + 0 /* ~ changed by cargo-mutants ~ */ } #[test] @@ -336,4 +379,9 @@ mod test { ); Ok(()) } + + fn strip_trailing_space(s: &str) -> String { + // Split on \n so that we retain empty lines etc + s.split('\n').map(|l| l.trim_end()).join("\n") + } } diff --git a/src/options.rs b/src/options.rs index b0a04a75..0fcaf3f1 100644 --- a/src/options.rs +++ b/src/options.rs @@ -46,6 +46,9 @@ pub struct Options { /// Show logs even from mutants that were caught, or source/unmutated builds. pub show_all_logs: bool, + /// List mutants with line and column numbers. + pub show_line_col: bool, + /// Test mutants in random order. /// /// This is now the default, so that repeated partial runs are more likely to find @@ -130,6 +133,7 @@ impl Options { print_caught: args.caught, print_unviable: args.unviable, shuffle: !args.no_shuffle, + show_line_col: args.line_col, show_times: !args.no_times, show_all_logs: args.all_logs, test_timeout: args.timeout.map(Duration::from_secs_f64), diff --git a/src/output.rs b/src/output.rs index 5233d7b4..babf5ed6 100644 --- a/src/output.rs +++ b/src/output.rs @@ -202,7 +202,7 @@ impl OutputDir { SummaryOutcome::Unviable => &mut self.unviable_list, _ => return Ok(()), }; - writeln!(file, "{mutant}").context("write to list file")?; + writeln!(file, "{}", mutant.name(true, false)).context("write to list file")?; } Ok(()) } diff --git a/src/scenario.rs b/src/scenario.rs index 59a28792..c1cd6d5a 100644 --- a/src/scenario.rs +++ b/src/scenario.rs @@ -18,7 +18,7 @@ impl fmt::Display for Scenario { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Scenario::Baseline => f.write_str("baseline"), - Scenario::Mutant(mutant) => mutant.fmt(f), + Scenario::Mutant(mutant) => f.write_str(&mutant.name(true, false)), } } } diff --git a/src/snapshots/cargo_mutants__visit__test__expected_mutants_for_own_source_tree.snap b/src/snapshots/cargo_mutants__visit__test__expected_mutants_for_own_source_tree.snap index 1b871e9b..f09656c5 100644 --- a/src/snapshots/cargo_mutants__visit__test__expected_mutants_for_own_source_tree.snap +++ b/src/snapshots/cargo_mutants__visit__test__expected_mutants_for_own_source_tree.snap @@ -14,8 +14,12 @@ src/cargo.rs: replace cargo_bin -> String with "xyzzy".into() src/cargo.rs: replace cargo_argv -> Vec with vec![] src/cargo.rs: replace cargo_argv -> Vec with vec![String::new()] src/cargo.rs: replace cargo_argv -> Vec with vec!["xyzzy".into()] +src/cargo.rs: replace == with != in cargo_argv +src/cargo.rs: replace == with != in cargo_argv +src/cargo.rs: replace == with != in cargo_argv src/cargo.rs: replace rustflags -> String with String::new() src/cargo.rs: replace rustflags -> String with "xyzzy".into() +src/cargo.rs: replace == with != in rustflags src/config.rs: replace Config::read_file -> Result with Ok(Default::default()) src/config.rs: replace Config::read_file -> Result with Err(::anyhow::anyhow!("mutated!")) src/config.rs: replace Config::read_tree_config -> Result with Ok(Default::default()) @@ -57,9 +61,12 @@ src/console.rs: replace ::flush -> io::Result<()> src/console.rs: replace ::render -> String with String::new() src/console.rs: replace ::render -> String with "xyzzy".into() src/console.rs: replace LabModel::find_scenario_mut -> &mut ScenarioModel with Box::leak(Box::new(Default::default())) +src/console.rs: replace == with != in LabModel::find_scenario_mut src/console.rs: replace LabModel::remove_scenario with () +src/console.rs: replace != with == in LabModel::remove_scenario src/console.rs: replace ::render -> String with String::new() src/console.rs: replace ::render -> String with "xyzzy".into() +src/console.rs: replace == with != in ::render src/console.rs: replace ScenarioModel::phase_started with () src/console.rs: replace ScenarioModel::phase_finished with () src/console.rs: replace ::render -> String with String::new() @@ -75,8 +82,6 @@ src/console.rs: replace style_outcome -> StyledObject<&'static str> with StyledO src/console.rs: replace style_outcome -> StyledObject<&'static str> with StyledObject::from_iter(["xyzzy"]) src/console.rs: replace style_outcome -> StyledObject<&'static str> with StyledObject::new("xyzzy") src/console.rs: replace style_outcome -> StyledObject<&'static str> with StyledObject::from("xyzzy") -src/console.rs: replace style_mutant -> String with String::new() -src/console.rs: replace style_mutant -> String with "xyzzy".into() src/console.rs: replace style_elapsed_secs -> String with String::new() src/console.rs: replace style_elapsed_secs -> String with "xyzzy".into() src/console.rs: replace style_secs -> String with String::new() @@ -100,6 +105,7 @@ src/console.rs: replace style_scenario -> Cow<'static, str> with Cow::Borrowed(" src/console.rs: replace style_scenario -> Cow<'static, str> with Cow::Owned("xyzzy".to_owned()) src/console.rs: replace plural -> String with String::new() src/console.rs: replace plural -> String with "xyzzy".into() +src/console.rs: replace == with != in plural src/copy_tree.rs: replace copy_tree -> Result with Ok(Default::default()) src/copy_tree.rs: replace copy_tree -> Result with Err(::anyhow::anyhow!("mutated!")) src/copy_tree.rs: replace copy_symlink -> Result<()> with Ok(()) @@ -110,16 +116,26 @@ src/fnvalue.rs: replace type_replacements -> impl Iterator w src/fnvalue.rs: replace type_replacements -> impl Iterator with ::std::iter::once(Default::default()) src/fnvalue.rs: replace path_ends_with -> bool with true src/fnvalue.rs: replace path_ends_with -> bool with false +src/fnvalue.rs: replace == with != in path_ends_with src/fnvalue.rs: replace match_impl_iterator -> Option<&Type> with None src/fnvalue.rs: replace match_impl_iterator -> Option<&Type> with Some(&Default::default()) +src/fnvalue.rs: replace == with != in match_impl_iterator +src/fnvalue.rs: replace == with != in match_impl_iterator +src/fnvalue.rs: replace == with != in match_impl_iterator src/fnvalue.rs: replace known_container -> Option<(&Ident, &Type)> with None src/fnvalue.rs: replace known_container -> Option<(&Ident, &Type)> with Some((&Default::default(), &Default::default())) +src/fnvalue.rs: replace == with != in known_container +src/fnvalue.rs: replace == with != in known_container src/fnvalue.rs: replace known_collection -> Option<(&Ident, &Type)> with None src/fnvalue.rs: replace known_collection -> Option<(&Ident, &Type)> with Some((&Default::default(), &Default::default())) +src/fnvalue.rs: replace == with != in known_collection +src/fnvalue.rs: replace == with != in known_collection src/fnvalue.rs: replace known_map -> Option<(&Ident, &Type, &Type)> with None src/fnvalue.rs: replace known_map -> Option<(&Ident, &Type, &Type)> with Some((&Default::default(), &Default::default(), &Default::default())) +src/fnvalue.rs: replace == with != in known_map src/fnvalue.rs: replace maybe_collection_or_container -> Option<(&Ident, &Type)> with None src/fnvalue.rs: replace maybe_collection_or_container -> Option<(&Ident, &Type)> with Some((&Default::default(), &Default::default())) +src/fnvalue.rs: replace == with != in maybe_collection_or_container src/fnvalue.rs: replace path_is_float -> bool with true src/fnvalue.rs: replace path_is_float -> bool with false src/fnvalue.rs: replace path_is_unsigned -> bool with true @@ -132,11 +148,13 @@ src/fnvalue.rs: replace path_is_nonzero_unsigned -> bool with true src/fnvalue.rs: replace path_is_nonzero_unsigned -> bool with false src/fnvalue.rs: replace match_first_type_arg -> Option<&'p Type> with None src/fnvalue.rs: replace match_first_type_arg -> Option<&'p Type> with Some(&Default::default()) +src/fnvalue.rs: replace == with != in match_first_type_arg src/in_diff.rs: replace diff_filter -> Result> with Ok(vec![]) src/in_diff.rs: replace diff_filter -> Result> with Ok(vec![Default::default()]) src/in_diff.rs: replace diff_filter -> Result> with Err(::anyhow::anyhow!("mutated!")) src/in_diff.rs: replace check_diff_new_text_matches -> Result<()> with Ok(()) src/in_diff.rs: replace check_diff_new_text_matches -> Result<()> with Err(::anyhow::anyhow!("mutated!")) +src/in_diff.rs: replace != with == in check_diff_new_text_matches src/in_diff.rs: replace strip_patch_path -> &Utf8Path with &Default::default() src/in_diff.rs: replace affected_lines -> Vec with vec![] src/in_diff.rs: replace affected_lines -> Vec with vec![0] @@ -149,8 +167,12 @@ src/in_diff.rs: replace partial_new_file -> Vec<(usize, &'d str)> with vec![(1, src/interrupt.rs: replace install_handler with () src/lab.rs: replace test_mutants -> Result with Ok(Default::default()) src/lab.rs: replace test_mutants -> Result with Err(::anyhow::anyhow!("mutated!")) +src/lab.rs: replace == with != in test_mutants +src/lab.rs: replace == with != in test_mutants +src/lab.rs: replace == with != in test_mutants src/lab.rs: replace test_scenario -> Result with Ok(Default::default()) src/lab.rs: replace test_scenario -> Result with Err(::anyhow::anyhow!("mutated!")) +src/lab.rs: replace == with != in test_scenario src/list.rs: replace >::write_str -> Result<(), fmt::Error> with Ok(()) src/list.rs: replace >::write_str -> Result<(), fmt::Error> with Err(::anyhow::anyhow!("mutated!")) src/list.rs: replace list_mutants -> Result<()> with Ok(()) @@ -159,6 +181,8 @@ src/list.rs: replace list_files -> Result<()> with Ok(()) src/list.rs: replace list_files -> Result<()> with Err(::anyhow::anyhow!("mutated!")) src/log_file.rs: replace LogFile::create_in -> Result with Ok(Default::default()) src/log_file.rs: replace LogFile::create_in -> Result with Err(::anyhow::anyhow!("mutated!")) +src/log_file.rs: replace == with != in LogFile::create_in +src/log_file.rs: replace == with != in LogFile::create_in src/log_file.rs: replace LogFile::open_append -> Result with Ok(Default::default()) src/log_file.rs: replace LogFile::open_append -> Result with Err(::anyhow::anyhow!("mutated!")) src/log_file.rs: replace LogFile::message with () @@ -173,6 +197,7 @@ src/manifest.rs: replace fix_manifest -> Result<()> with Err(::anyhow::anyhow!(" src/manifest.rs: replace fix_manifest_toml -> Result> with Ok(None) src/manifest.rs: replace fix_manifest_toml -> Result> with Ok(Some(Default::default())) src/manifest.rs: replace fix_manifest_toml -> Result> with Err(::anyhow::anyhow!("mutated!")) +src/manifest.rs: replace == with != in fix_manifest_toml src/manifest.rs: replace fix_dependency_table with () src/manifest.rs: replace fix_cargo_config -> Result<()> with Ok(()) src/manifest.rs: replace fix_cargo_config -> Result<()> with Err(::anyhow::anyhow!("mutated!")) @@ -183,18 +208,34 @@ src/manifest.rs: replace fix_cargo_config_toml -> Result> with Er src/manifest.rs: replace fix_path -> Option with None src/manifest.rs: replace fix_path -> Option with Some(String::new()) src/manifest.rs: replace fix_path -> Option with Some("xyzzy".into()) +src/manifest.rs: replace == with != in fix_path src/mutate.rs: replace Mutant::mutated_code -> String with String::new() src/mutate.rs: replace Mutant::mutated_code -> String with "xyzzy".into() -src/mutate.rs: replace Mutant::original_code -> &str with "" -src/mutate.rs: replace Mutant::original_code -> &str with "xyzzy" -src/mutate.rs: replace Mutant::return_type -> &str with "" -src/mutate.rs: replace Mutant::return_type -> &str with "xyzzy" src/mutate.rs: replace Mutant::describe_change -> String with String::new() src/mutate.rs: replace Mutant::describe_change -> String with "xyzzy".into() +src/mutate.rs: replace Mutant::name -> String with String::new() +src/mutate.rs: replace Mutant::name -> String with "xyzzy".into() +src/mutate.rs: replace Mutant::styled_parts -> Vec> with vec![] +src/mutate.rs: replace Mutant::styled_parts -> Vec> with vec![StyledObject::new()] +src/mutate.rs: replace Mutant::styled_parts -> Vec> with vec![StyledObject::from_iter([String::new()])] +src/mutate.rs: replace Mutant::styled_parts -> Vec> with vec![StyledObject::new(String::new())] +src/mutate.rs: replace Mutant::styled_parts -> Vec> with vec![StyledObject::from(String::new())] +src/mutate.rs: replace Mutant::styled_parts -> Vec> with vec![StyledObject::from_iter(["xyzzy".into()])] +src/mutate.rs: replace Mutant::styled_parts -> Vec> with vec![StyledObject::new("xyzzy".into())] +src/mutate.rs: replace Mutant::styled_parts -> Vec> with vec![StyledObject::from("xyzzy".into())] +src/mutate.rs: replace Mutant::styled_parts::s -> StyledObject with StyledObject::new() +src/mutate.rs: replace Mutant::styled_parts::s -> StyledObject with StyledObject::from_iter([String::new()]) +src/mutate.rs: replace Mutant::styled_parts::s -> StyledObject with StyledObject::new(String::new()) +src/mutate.rs: replace Mutant::styled_parts::s -> StyledObject with StyledObject::from(String::new()) +src/mutate.rs: replace Mutant::styled_parts::s -> StyledObject with StyledObject::from_iter(["xyzzy".into()]) +src/mutate.rs: replace Mutant::styled_parts::s -> StyledObject with StyledObject::new("xyzzy".into()) +src/mutate.rs: replace Mutant::styled_parts::s -> StyledObject with StyledObject::from("xyzzy".into()) +src/mutate.rs: replace != with == in Mutant::styled_parts +src/mutate.rs: replace == with != in Mutant::styled_parts +src/mutate.rs: replace Mutant::original_text -> String with String::new() +src/mutate.rs: replace Mutant::original_text -> String with "xyzzy".into() src/mutate.rs: replace Mutant::replacement_text -> &str with "" src/mutate.rs: replace Mutant::replacement_text -> &str with "xyzzy" -src/mutate.rs: replace Mutant::function_name -> &str with "" -src/mutate.rs: replace Mutant::function_name -> &str with "xyzzy" src/mutate.rs: replace Mutant::package_name -> &str with "" src/mutate.rs: replace Mutant::package_name -> &str with "xyzzy" src/mutate.rs: replace Mutant::package -> &Package with &Default::default() @@ -210,8 +251,6 @@ src/mutate.rs: replace Mutant::log_file_name_base -> String with String::new() src/mutate.rs: replace Mutant::log_file_name_base -> String with "xyzzy".into() src/mutate.rs: replace ::fmt -> fmt::Result with Ok(Default::default()) src/mutate.rs: replace ::fmt -> fmt::Result with Err(::anyhow::anyhow!("mutated!")) -src/mutate.rs: replace ::fmt -> fmt::Result with Ok(Default::default()) -src/mutate.rs: replace ::fmt -> fmt::Result with Err(::anyhow::anyhow!("mutated!")) src/mutate.rs: replace ::serialize -> Result with Ok(Default::default()) src/mutate.rs: replace ::serialize -> Result with Err(::anyhow::anyhow!("mutated!")) src/options.rs: replace join_slices -> Vec with vec![] @@ -250,10 +289,15 @@ src/outcome.rs: replace ScenarioOutcome::has_timeout -> bool with true src/outcome.rs: replace ScenarioOutcome::has_timeout -> bool with false src/outcome.rs: replace ScenarioOutcome::check_or_build_failed -> bool with true src/outcome.rs: replace ScenarioOutcome::check_or_build_failed -> bool with false +src/outcome.rs: replace != with == in ScenarioOutcome::check_or_build_failed +src/outcome.rs: replace == with != in ScenarioOutcome::check_or_build_failed src/outcome.rs: replace ScenarioOutcome::mutant_caught -> bool with true src/outcome.rs: replace ScenarioOutcome::mutant_caught -> bool with false +src/outcome.rs: replace == with != in ScenarioOutcome::mutant_caught +src/outcome.rs: replace == with != in ScenarioOutcome::mutant_caught src/outcome.rs: replace ScenarioOutcome::mutant_missed -> bool with true src/outcome.rs: replace ScenarioOutcome::mutant_missed -> bool with false +src/outcome.rs: replace == with != in ScenarioOutcome::mutant_missed src/outcome.rs: replace ScenarioOutcome::summary -> SummaryOutcome with Default::default() src/outcome.rs: replace PhaseResult::is_success -> bool with true src/outcome.rs: replace PhaseResult::is_success -> bool with false @@ -261,6 +305,7 @@ src/outcome.rs: replace ::serialize -> Result::serialize -> Result with Err(::anyhow::anyhow!("mutated!")) src/output.rs: replace LockFile::acquire_lock -> Result with Ok(Default::default()) src/output.rs: replace LockFile::acquire_lock -> Result with Err(::anyhow::anyhow!("mutated!")) +src/output.rs: replace == with != in LockFile::acquire_lock src/output.rs: replace OutputDir::create_log -> Result with Ok(Default::default()) src/output.rs: replace OutputDir::create_log -> Result with Err(::anyhow::anyhow!("mutated!")) src/output.rs: replace OutputDir::path -> &Utf8Path with &Default::default() @@ -276,10 +321,16 @@ src/output.rs: replace OutputDir::take_lab_outcome -> LabOutcome with Default::d src/path.rs: replace ascent -> isize with 0 src/path.rs: replace ascent -> isize with 1 src/path.rs: replace ascent -> isize with -1 +src/path.rs: replace == with != in ascent +src/path.rs: replace != with == in ascent src/path.rs: replace ::to_slash_path -> String with String::new() src/path.rs: replace ::to_slash_path -> String with "xyzzy".into() +src/path.rs: replace == with != in ::to_slash_path +src/path.rs: replace == with != in ::to_slash_path src/pretty.rs: replace ::to_pretty_string -> String with String::new() src/pretty.rs: replace ::to_pretty_string -> String with "xyzzy".into() +src/pretty.rs: replace == with != in ::to_pretty_string +src/pretty.rs: replace == with != in ::to_pretty_string src/process.rs: replace Process::run -> Result with Ok(Default::default()) src/process.rs: replace Process::run -> Result with Err(::anyhow::anyhow!("mutated!")) src/process.rs: replace Process::start -> Result with Ok(Default::default()) @@ -288,10 +339,13 @@ src/process.rs: replace Process::terminate -> Result<()> with Ok(()) src/process.rs: replace Process::terminate -> Result<()> with Err(::anyhow::anyhow!("mutated!")) src/process.rs: replace terminate_child_impl -> Result<()> with Ok(()) src/process.rs: replace terminate_child_impl -> Result<()> with Err(::anyhow::anyhow!("mutated!")) +src/process.rs: replace != with == in terminate_child_impl src/process.rs: replace ProcessStatus::success -> bool with true src/process.rs: replace ProcessStatus::success -> bool with false +src/process.rs: replace == with != in ProcessStatus::success src/process.rs: replace ProcessStatus::timeout -> bool with true src/process.rs: replace ProcessStatus::timeout -> bool with false +src/process.rs: replace == with != in ProcessStatus::timeout src/process.rs: replace setpgid_on_unix -> PopenConfig with Default::default() src/process.rs: replace get_command_output -> Result with Ok(String::new()) src/process.rs: replace get_command_output -> Result with Ok("xyzzy".into()) @@ -305,11 +359,32 @@ src/scenario.rs: replace Scenario::log_file_name_base -> String with "xyzzy".int src/source.rs: replace SourceFile::tree_relative_slashes -> String with String::new() src/source.rs: replace SourceFile::tree_relative_slashes -> String with "xyzzy".into() src/source.rs: replace SourceFile::path -> &Utf8Path with &Default::default() -src/textedit.rs: replace ::from -> Self with Default::default() -src/textedit.rs: replace ::from -> Self with Default::default() -src/textedit.rs: replace ::from -> Self with Default::default() -src/textedit.rs: replace replace_region -> String with String::new() -src/textedit.rs: replace replace_region -> String with "xyzzy".into() +src/span.rs: replace ::from -> Self with Default::default() +src/span.rs: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/span.rs: replace ::fmt -> fmt::Result with Err(::anyhow::anyhow!("mutated!")) +src/span.rs: replace Span::quad -> Self with Default::default() +src/span.rs: replace Span::extract -> String with String::new() +src/span.rs: replace Span::extract -> String with "xyzzy".into() +src/span.rs: replace == with != in Span::extract +src/span.rs: replace == with != in Span::extract +src/span.rs: replace == with != in Span::extract +src/span.rs: replace == with != in Span::extract +src/span.rs: replace == with != in Span::extract +src/span.rs: replace Span::replace -> String with String::new() +src/span.rs: replace Span::replace -> String with "xyzzy".into() +src/span.rs: replace == with != in Span::replace +src/span.rs: replace == with != in Span::replace +src/span.rs: replace == with != in Span::replace +src/span.rs: replace == with != in Span::replace +src/span.rs: replace == with != in Span::replace +src/span.rs: replace == with != in Span::replace +src/span.rs: replace == with != in Span::replace +src/span.rs: replace == with != in Span::replace +src/span.rs: replace ::from -> Self with Default::default() +src/span.rs: replace ::from -> Self with Default::default() +src/span.rs: replace ::from -> Self with Default::default() +src/span.rs: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/span.rs: replace ::fmt -> fmt::Result with Err(::anyhow::anyhow!("mutated!")) src/visit.rs: replace walk_tree -> Result with Ok(Default::default()) src/visit.rs: replace walk_tree -> Result with Err(::anyhow::anyhow!("mutated!")) src/visit.rs: replace walk_file -> Result<(Vec, Vec)> with Ok((vec![], vec![])) @@ -319,12 +394,21 @@ src/visit.rs: replace walk_file -> Result<(Vec, Vec)> with Ok((v src/visit.rs: replace walk_file -> Result<(Vec, Vec)> with Ok((vec![Default::default()], vec![String::new()])) src/visit.rs: replace walk_file -> Result<(Vec, Vec)> with Ok((vec![Default::default()], vec!["xyzzy".into()])) src/visit.rs: replace walk_file -> Result<(Vec, Vec)> with Err(::anyhow::anyhow!("mutated!")) +src/visit.rs: replace DiscoveryVisitor<'o>::enter_function -> Arc with Arc::new(Default::default()) +src/visit.rs: replace DiscoveryVisitor<'o>::leave_function with () src/visit.rs: replace DiscoveryVisitor<'o>::collect_fn_mutants with () src/visit.rs: replace DiscoveryVisitor<'o>::in_namespace -> T with Default::default() src/visit.rs: replace >::visit_item_fn with () src/visit.rs: replace >::visit_impl_item_fn with () +src/visit.rs: replace == with != in >::visit_impl_item_fn src/visit.rs: replace >::visit_item_impl with () +src/visit.rs: replace == with != in >::visit_item_impl src/visit.rs: replace >::visit_item_mod with () +src/visit.rs: replace >::visit_expr_binary with () +src/visit.rs: replace function_body_span -> Option with None +src/visit.rs: replace function_body_span -> Option with Some(Default::default()) +src/visit.rs: replace binary_operator_replacements -> Vec with vec![] +src/visit.rs: replace binary_operator_replacements -> Vec with vec![Default::default()] src/visit.rs: replace find_mod_source -> Result> with Ok(None) src/visit.rs: replace find_mod_source -> Result> with Ok(Some(Default::default())) src/visit.rs: replace find_mod_source -> Result> with Err(::anyhow::anyhow!("mutated!")) @@ -345,6 +429,7 @@ src/visit.rs: replace attr_is_mutants_skip -> bool with false src/workspace.rs: replace PackageFilter::explicit -> PackageFilter with Default::default() src/workspace.rs: replace PackageFilter::resolve_auto -> Result with Ok(Default::default()) src/workspace.rs: replace PackageFilter::resolve_auto -> Result with Err(::anyhow::anyhow!("mutated!")) +src/workspace.rs: replace == with != in PackageFilter::resolve_auto src/workspace.rs: replace Workspace::open -> Result with Ok(Default::default()) src/workspace.rs: replace Workspace::open -> Result with Err(::anyhow::anyhow!("mutated!")) src/workspace.rs: replace Workspace::packages -> Result>> with Ok(vec![]) @@ -353,6 +438,7 @@ src/workspace.rs: replace Workspace::packages -> Result>> with src/workspace.rs: replace Workspace::package_tops -> Result> with Ok(vec![]) src/workspace.rs: replace Workspace::package_tops -> Result> with Ok(vec![Default::default()]) src/workspace.rs: replace Workspace::package_tops -> Result> with Err(::anyhow::anyhow!("mutated!")) +src/workspace.rs: replace == with != in Workspace::package_tops src/workspace.rs: replace Workspace::top_sources -> Result>> with Ok(vec![]) src/workspace.rs: replace Workspace::top_sources -> Result>> with Ok(vec![Arc::new(Default::default())]) src/workspace.rs: replace Workspace::top_sources -> Result>> with Err(::anyhow::anyhow!("mutated!")) @@ -366,6 +452,7 @@ src/workspace.rs: replace direct_package_sources -> Result> wit src/workspace.rs: replace direct_package_sources -> Result> with Err(::anyhow::anyhow!("mutated!")) src/workspace.rs: replace should_mutate_target -> bool with true src/workspace.rs: replace should_mutate_target -> bool with false +src/workspace.rs: replace == with != in should_mutate_target src/workspace.rs: replace locate_project -> Result with Ok(Default::default()) src/workspace.rs: replace locate_project -> Result with Err(::anyhow::anyhow!("mutated!")) diff --git a/src/span.rs b/src/span.rs new file mode 100644 index 00000000..5dd0b817 --- /dev/null +++ b/src/span.rs @@ -0,0 +1,273 @@ +// Copyright 2021-2023 Martin Pool + +//! Locations (line/column) and spans between them in source code. +//! +//! This is similar to, and can be automatically derived from, +//! [proc_macro2::Span] and [proc_macro2::LineColumn], but is +//! a bit more convenient for our purposes. + +use std::fmt; + +use serde::Serialize; + +/// A (line, column) position in a source file. +#[derive(Clone, Copy, Eq, PartialEq, Serialize)] +pub struct LineColumn { + /// 1-based line number. + pub line: usize, + + /// 1-based column, measured in chars. + pub column: usize, +} + +impl From for LineColumn { + fn from(l: proc_macro2::LineColumn) -> Self { + LineColumn { + line: l.line, + column: l.column + 1, + } + } +} + +impl fmt::Debug for LineColumn { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "LineColumn({}, {})", self.line, self.column) + } +} + +/// A contiguous text span in a file. +#[derive(Clone, Copy, Eq, PartialEq, Serialize)] +pub struct Span { + /// The *inclusive* position where the span starts. + pub start: LineColumn, + /// The *exclusive* position where the span ends. + pub end: LineColumn, +} + +impl Span { + #[allow(dead_code)] + pub fn quad( + start_line: usize, + start_column: usize, + end_line: usize, + end_column: usize, + ) -> Self { + Span { + start: LineColumn { + line: start_line, + column: start_column, + }, + end: LineColumn { + line: end_line, + column: end_column, + }, + } + } + + /// Return the region of a multi-line string that this span covers. + pub fn extract(&self, s: &str) -> String { + let mut r = String::new(); + let mut line_no = 1; + let mut col_no = 1; + let start = self.start; + let end = self.end; + for c in s.chars() { + if ((line_no == start.line && col_no >= start.column) || line_no > start.line) + && (line_no < end.line || (line_no == end.line && col_no < end.column)) + { + r.push(c); + } + if c == '\n' { + line_no += 1; + if line_no > end.line { + break; + } + col_no = 1; + } else if c == '\r' { + // counts as part of the last column, not a separate column + } else { + col_no += 1; + } + if line_no == end.line && col_no >= end.column { + break; + } + } + r + } + + /// Replace a subregion of text. + /// + /// Returns a copy of `s` with the region identified by this span replaced by + /// `replacement`. + pub fn replace(&self, s: &str, replacement: &str) -> String { + let mut r = String::with_capacity(s.len() + replacement.len()); + let mut line_no = 1; + let mut col_no = 1; + let start = self.start; + let end = self.end; + for c in s.chars() { + if line_no == start.line && col_no == start.column { + r.push_str(replacement); + } + if line_no < start.line + || line_no > end.line + || (line_no == start.line && col_no < start.column) + || (line_no == end.line && col_no >= end.column) + { + r.push(c); + } + if c == '\n' { + line_no += 1; + col_no = 1; + } else if c == '\r' { + // counts as part of the last column, not a separate column + } else { + col_no += 1; + } + } + if line_no == start.line && col_no == start.column { + r.push_str(replacement); + } + r + } +} + +impl From for Span { + fn from(s: proc_macro2::Span) -> Self { + Span { + start: s.start().into(), + end: s.end().into(), + } + } +} + +impl From<&proc_macro2::Span> for Span { + fn from(s: &proc_macro2::Span) -> Self { + Span { + start: s.start().into(), + end: s.end().into(), + } + } +} + +impl From for Span { + fn from(s: proc_macro2::extra::DelimSpan) -> Self { + // Get the span for the whole block from the start delimiter + // to the end. + let joined = s.join(); + Span { + start: joined.start().into(), + end: joined.end().into(), + } + } +} + +impl fmt::Debug for Span { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + // A concise form, similar to ::quad + write!( + f, + "Span({}, {}, {}, {})", + self.start.line, self.start.column, self.end.line, self.end.column + ) + } +} + +#[cfg(test)] +mod test { + use indoc::indoc; + // use pretty_assertions::assert_eq; + + use super::*; + + #[test] + fn linecolumn_debug_form() { + let lc = LineColumn { line: 1, column: 2 }; + assert_eq!(format!("{:?}", lc), "LineColumn(1, 2)"); + } + + #[test] + fn span_debug_form() { + let span = Span::quad(1, 2, 3, 4); + assert_eq!(format!("{:?}", span), "Span(1, 2, 3, 4)"); + } + + #[test] + fn cut_before_crlf() { + let source = "fn foo() {\r\n wibble();\r\n}\r\n//hey!\r\n"; + let span = Span::quad(1, 10, 3, 2); + assert_eq!(span.extract(source), "{\r\n wibble();\r\n}"); + assert_eq!(span.replace(source, "{}"), "fn foo() {}\r\n//hey!\r\n"); + } + + #[test] + fn empty_span_in_empty_string() { + let span = Span::quad(1, 1, 1, 1); + assert_eq!(span.extract(""), ""); + assert_eq!(span.replace("", "x"), "x"); + } + + #[test] + fn empty_span_at_start_of_string() { + let span = Span::quad(1, 1, 1, 1); + assert_eq!(span.extract("hello"), ""); + assert_eq!(span.replace("hello", "x"), "xhello"); + } + + #[test] + fn empty_span_at_end_of_string() { + let span = Span::quad(1, 6, 1, 6); + assert_eq!(span.extract("hello"), ""); + assert_eq!(span.replace("hello", "x"), "hellox"); + } + + #[test] + fn cut_including_crlf() { + let source = "fn foo() {\r\n wibble();\r\n}\r\n//hey!\r\n"; + let span = Span::quad(1, 10, 3, 3); + assert_eq!(span.extract(source), "{\r\n wibble();\r\n}\r\n"); + assert_eq!(span.replace(source, "{}\r\n"), "fn foo() {}\r\n//hey!\r\n"); + } + #[test] + fn span_ops() { + let source = indoc! { r#" + + fn foo() { + some(); + stuff(); + } + + const BAR: u32 = 32; + "# }; + // typical multi-line case + let span = Span::quad(2, 10, 5, 2); + assert_eq!(span.extract(source), "{\n some();\n stuff();\n}"); + let replaced = span.replace(source, "{ /* body deleted */ }"); + assert_eq!( + replaced, + indoc! { r#" + + fn foo() { /* body deleted */ } + + const BAR: u32 = 32; + "# } + ); + + // single-line case + let span = Span::quad(7, 18, 7, 20); + assert_eq!(span.extract(source), "32"); + let replaced = span.replace(source, "69"); + assert_eq!( + replaced, + indoc! { r#" + + fn foo() { + some(); + stuff(); + } + + const BAR: u32 = 69; + "# } + ); + } +} diff --git a/src/textedit.rs b/src/textedit.rs deleted file mode 100644 index a26131d3..00000000 --- a/src/textedit.rs +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2021 Martin Pool - -//! Edit source code. - -use serde::Serialize; - -/// A (line, column) position in a source file. -#[derive(Clone, Copy, Eq, PartialEq, Debug, Serialize)] -pub struct LineColumn { - /// 1-based line number. - pub line: usize, - - /// 1-based column, measured in chars. - pub column: usize, -} - -impl From for LineColumn { - fn from(l: proc_macro2::LineColumn) -> Self { - LineColumn { - line: l.line, - column: l.column + 1, - } - } -} - -/// A contiguous text span in a file. -/// -/// TODO: Perhaps a semi-open range that can represent an empty span would be more general? -#[derive(Clone, Copy, Eq, PartialEq, Debug, Serialize)] -pub struct Span { - /// The inclusive position where the span starts. - pub start: LineColumn, - /// The inclusive position where the span ends. - pub end: LineColumn, -} - -impl From for Span { - fn from(s: proc_macro2::Span) -> Self { - Span { - start: s.start().into(), - end: s.end().into(), - } - } -} - -impl From<&proc_macro2::Span> for Span { - fn from(s: &proc_macro2::Span) -> Self { - Span { - start: s.start().into(), - end: s.end().into(), - } - } -} - -/// Replace a subregion of text. -/// -/// Returns a copy of `s` with the region between `start` and `end` inclusive replaced by -/// `replacement`. -pub(crate) fn replace_region( - s: &str, - start: &LineColumn, - end: &LineColumn, - replacement: &str, -) -> String { - // dbg!(start, end); - let mut r = String::with_capacity(s.len() + replacement.len()); - let mut line_no = 1; - let mut col_no = 1; - for c in s.chars() { - if line_no < start.line - || line_no > end.line - || (line_no == start.line && col_no < start.column) - || (line_no == end.line && col_no > end.column) - { - r.push(c); - } else if line_no == start.line && col_no == start.column { - r.push_str(replacement); - } - if c == '\n' { - line_no += 1; - col_no = 1; - } else if c == '\r' { - // counts as part of the last column, not a separate column - } else { - col_no += 1; - } - } - r -} - -#[cfg(test)] -mod test { - use indoc::indoc; - use pretty_assertions::assert_eq; - - use super::*; - - #[test] - fn replace_treats_crlf_as_part_of_last_column() { - let source = "fn foo() {\r\n wibble();\r\n}\r\n//hey!\r\n"; - assert_eq!( - replace_region( - source, - &LineColumn { - line: 1, - column: 10 - }, - &LineColumn { line: 3, column: 2 }, - "{}\r\n" - ), - "fn foo() {}\r\n//hey!\r\n" - ); - } - - #[test] - fn test_replace_region() { - let source = indoc! { r#" - - fn foo() { - some(); - stuff(); - } - - const BAR: u32 = 32; - "# }; - // typical multi-line case - let replaced = replace_region( - source, - &LineColumn { - line: 2, - column: 10, - }, - &LineColumn { line: 5, column: 1 }, - "{ /* body deleted */ }", - ); - assert_eq!( - replaced, - indoc! { r#" - - fn foo() { /* body deleted */ } - - const BAR: u32 = 32; - "# } - ); - - // single-line case - let replaced = replace_region( - source, - &LineColumn { - line: 7, - column: 18, - }, - &LineColumn { - line: 7, - column: 19, - }, - "69", - ); - assert_eq!( - replaced, - indoc! { r#" - - fn foo() { - some(); - stuff(); - } - - const BAR: u32 = 69; - "# } - ); - } -} diff --git a/src/visit.rs b/src/visit.rs index 680cf31e..b03153d5 100644 --- a/src/visit.rs +++ b/src/visit.rs @@ -12,14 +12,19 @@ use std::sync::Arc; use anyhow::Context; use itertools::Itertools; +use proc_macro2::{Ident, TokenStream}; +use quote::quote; use syn::ext::IdentExt; +use syn::spanned::Spanned; use syn::visit::Visit; -use syn::{Attribute, Expr, ItemFn, ReturnType}; +use syn::{Attribute, BinOp, Block, Expr, ItemFn, ReturnType, Signature}; use tracing::{debug, debug_span, trace, trace_span, warn}; use crate::fnvalue::return_type_replacements; +use crate::mutate::Function; use crate::pretty::ToPrettyString; use crate::source::SourceFile; +use crate::span::Span; use crate::*; /// Mutants and files discovered in a source tree. @@ -81,15 +86,14 @@ pub fn walk_tree( continue; } } - if !options.examine_names.is_empty() { - file_mutants.retain(|m| options.examine_names.is_match(&m.to_string())); - } - if !options.exclude_names.is_empty() { - file_mutants.retain(|m| !options.exclude_names.is_match(&m.to_string())); - } mutants.append(&mut file_mutants); files.push(source_file); } + mutants.retain(|m| { + let name = m.name(true, false); + (options.examine_names.is_empty() || options.examine_names.is_match(&name)) + && (options.exclude_names.is_empty() || !options.exclude_names.is_match(&name)) + }); console.walk_tree_done(); Ok(Discovered { mutants, files }) } @@ -111,7 +115,8 @@ fn walk_file( external_mods: Vec::new(), mutants: Vec::new(), namespace_stack: Vec::new(), - source_file: source_file.clone(), + fn_stack: Vec::new(), + source_file: Arc::clone(&source_file), }; visitor.visit_file(&syn_file); Ok((visitor.mutants, visitor.external_mods)) @@ -132,6 +137,9 @@ struct DiscoveryVisitor<'o> { /// The stack of namespaces we're currently inside. namespace_stack: Vec, + /// The functions we're inside. + fn_stack: Vec>, + /// The names from `mod foo;` statements that should be visited later. external_mods: Vec, @@ -140,27 +148,57 @@ struct DiscoveryVisitor<'o> { } impl<'o> DiscoveryVisitor<'o> { - fn collect_fn_mutants(&mut self, return_type: &ReturnType, span: &proc_macro2::Span) { - let full_function_name = Arc::new(self.namespace_stack.join("::")); - let return_type_str = Arc::new(return_type.to_pretty_string()); - let mut new_mutants = return_type_replacements(return_type, self.error_exprs) - .map(|rep| Mutant { - source_file: Arc::clone(&self.source_file), - function_name: Arc::clone(&full_function_name), - return_type: Arc::clone(&return_type_str), - replacement: rep.to_pretty_string(), - span: span.into(), - genre: Genre::FnValue, - }) - .collect_vec(); - if new_mutants.is_empty() { - debug!( - ?full_function_name, - ?return_type_str, - "No mutants generated for this return type" - ); + fn enter_function( + &mut self, + function_name: &Ident, + return_type: &ReturnType, + span: proc_macro2::Span, + ) -> Arc { + self.namespace_stack.push(function_name.to_string()); + let function_name = self.namespace_stack.join("::"); + let function = Arc::new(Function { + function_name: function_name.to_owned(), + return_type: return_type.to_pretty_string(), + span: span.into(), + }); + self.fn_stack.push(Arc::clone(&function)); + function + } + + fn leave_function(&mut self, function: Arc) { + self.namespace_stack + .pop() + .expect("Namespace stack should not be empty"); + assert_eq!( + self.fn_stack.pop(), + Some(function), + "Function stack mismatch" + ); + } + + fn collect_fn_mutants(&mut self, sig: &Signature, block: &Block) { + if let Some(function) = self.fn_stack.last() { + let body_span = function_body_span(block).expect("Empty function body"); + let mut new_mutants = return_type_replacements(&sig.output, self.error_exprs) + .map(|rep| Mutant { + source_file: Arc::clone(&self.source_file), + function: Some(Arc::clone(function)), + span: body_span, + replacement: rep.to_pretty_string(), + genre: Genre::FnValue, + }) + .collect_vec(); + if new_mutants.is_empty() { + debug!( + function_name = function.function_name, + return_type = function.return_type, + "No mutants generated for this return type" + ); + } else { + self.mutants.append(&mut new_mutants); + } } else { - self.mutants.append(&mut new_mutants); + warn!("collect_fn_mutants called while not in a function?"); } } @@ -191,10 +229,10 @@ impl<'ast> Visit<'ast> for DiscoveryVisitor<'_> { if fn_sig_excluded(&i.sig) || attrs_excluded(&i.attrs) || block_is_empty(&i.block) { return; } - self.in_namespace(&function_name, |self_| { - self_.collect_fn_mutants(&i.sig.output, &i.block.brace_token.span.join()); - syn::visit::visit_item_fn(self_, i); - }); + let function = self.enter_function(&i.sig.ident, &i.sig.output, i.span()); + self.collect_fn_mutants(&i.sig, &i.block); + syn::visit::visit_item_fn(self, i); + self.leave_function(function); } /// Visit `fn foo()` within an `impl`. @@ -215,10 +253,10 @@ impl<'ast> Visit<'ast> for DiscoveryVisitor<'_> { { return; } - self.in_namespace(&function_name, |self_| { - self_.collect_fn_mutants(&i.sig.output, &i.block.brace_token.span.join()); - syn::visit::visit_impl_item_fn(self_, i) - }); + let function = self.enter_function(&i.sig.ident, &i.sig.output, i.span()); + self.collect_fn_mutants(&i.sig, &i.block); + syn::visit::visit_impl_item_fn(self, i); + self.leave_function(function); } /// Visit `impl Foo { ...}` or `impl Debug for Foo { ... }`. @@ -256,6 +294,53 @@ impl<'ast> Visit<'ast> for DiscoveryVisitor<'_> { } self.in_namespace(mod_name, |v| syn::visit::visit_item_mod(v, node)); } + + /// Visit `a op b` expressions. + fn visit_expr_binary(&mut self, i: &'ast syn::ExprBinary) { + let _span = trace_span!("binary", line = i.op.span().start().line).entered(); + if attrs_excluded(&i.attrs) { + return; + } + let mut new_mutants = binary_operator_replacements(i.op) + .into_iter() + .map(|rep| Mutant { + source_file: Arc::clone(&self.source_file), + function: self.fn_stack.last().map(Arc::clone), + replacement: rep.to_pretty_string(), + span: i.op.span().into(), + genre: Genre::BinaryOperator, + }) + .collect_vec(); + if new_mutants.is_empty() { + debug!( + op = i.op.to_pretty_string(), + "No mutants generated for this binary operator" + ); + } else { + self.mutants.append(&mut new_mutants); + } + syn::visit::visit_expr_binary(self, i); + } +} + +// Get the span of the block excluding the braces, or None if it is empty. +fn function_body_span(block: &Block) -> Option { + let start = block.stmts.first()?.span().start(); + let end = block.stmts.last()?.span().end(); + Some(Span { + start: start.into(), + end: end.into(), + }) +} + +fn binary_operator_replacements(op: syn::BinOp) -> Vec { + match op { + // We don't generate `<=` from `==` because it can too easily go + // wrong with unsigned types compared to 0. + BinOp::Eq(_) => vec![quote! { != }], + BinOp::Ne(_) => vec![quote! { == }], + _ => Vec::new(), + } } /// Find a new source file referenced by a `mod` statement. @@ -389,8 +474,6 @@ fn attr_is_mutants_skip(attr: &Attribute) -> bool { #[cfg(test)] mod test { - use regex::Regex; - use super::*; /// As a generic protection against regressions in discovery, the the mutants @@ -404,6 +487,7 @@ mod test { fn expected_mutants_for_own_source_tree() { let options = Options { error_values: vec!["::anyhow::anyhow!(\"mutated!\")".to_owned()], + show_line_col: false, ..Default::default() }; let mut list_output = String::new(); @@ -419,10 +503,6 @@ mod test { .expect("Discover mutants"); crate::list_mutants(&mut list_output, &discovered.mutants, &options) .expect("Discover mutants in own source tree"); - - // Strip line numbers so this is not too brittle. - let line_re = Regex::new(r"(?m)^([^:]+:)\d+:( .*)$").unwrap(); - let list_output = line_re.replace_all(&list_output, "$1$2"); insta::assert_snapshot!(list_output); } } diff --git a/testdata/well_tested/src/lib.rs b/testdata/well_tested/src/lib.rs index dcbf106e..fdda45b8 100644 --- a/testdata/well_tested/src/lib.rs +++ b/testdata/well_tested/src/lib.rs @@ -19,4 +19,5 @@ mod result; mod sets; pub mod simple_fns; mod slices; +mod static_item; mod struct_with_lifetime; diff --git a/testdata/well_tested/src/numbers.rs b/testdata/well_tested/src/numbers.rs index 7c4a247c..a6f63a4b 100644 --- a/testdata/well_tested/src/numbers.rs +++ b/testdata/well_tested/src/numbers.rs @@ -2,6 +2,10 @@ fn double_float(a: f32) -> f32 { 2.0 * a } +fn is_double(a: u32, b: u32) -> bool { + a == 2 * b +} + #[cfg(test)] mod test { use super::*; @@ -15,4 +19,16 @@ mod test { fn double_three() { assert_eq!(double_float(3.0), 6.0); } + + #[test] + fn is_double_zero() { + assert!(is_double(0, 0)); + } + + #[test] + fn is_double_one() { + assert!(is_double(2, 1)); + assert!(!is_double(1, 1)); + assert!(!is_double(5, 1)); + } } diff --git a/testdata/well_tested/src/static_item.rs b/testdata/well_tested/src/static_item.rs new file mode 100644 index 00000000..d8011a37 --- /dev/null +++ b/testdata/well_tested/src/static_item.rs @@ -0,0 +1,8 @@ +static SHOULD_BE_TRUE: bool = 3 == (2 + 1); + +mod test { + #[test] + fn static_expression_evaluated() { + assert!(super::SHOULD_BE_TRUE); + } +} diff --git a/tests/cli/config.rs b/tests/cli/config.rs index 9bf0b1dc..0461cec6 100644 --- a/tests/cli/config.rs +++ b/tests/cli/config.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Martin Pool. +// Copyright 2022, 2023 Martin Pool. //! Test handling of `mutants.toml` configuration. @@ -163,13 +163,14 @@ fn list_with_config_file_regexps() { "#, ); run() - .args(["mutants", "--list", "-d"]) + .args(["mutants", "--list", "--line-col=false", "-d"]) .arg(testdata.path()) .assert() .success() - .stdout(predicates::str::diff( - "src/simple_fns.rs:17: replace divisible_by_three -> bool with false\n", - )); + .stdout(predicates::str::diff(indoc! {"\ + src/simple_fns.rs: replace divisible_by_three -> bool with false + src/simple_fns.rs: replace == with != in divisible_by_three + "})); } #[test] @@ -178,8 +179,8 @@ fn exclude_re_overrides_config() { write_config_file( &testdata, r#" - exclude_re = [".*"] # would exclude everything - "#, +exclude_re = [".*"] # would exclude everything +"#, ); run() .args(["mutants", "--list", "-d"]) @@ -189,14 +190,15 @@ fn exclude_re_overrides_config() { .stdout(predicates::str::is_empty()); // Also tests that the alias --exclude-regex is accepted run() - .args(["mutants", "--list", "-d"]) + .args(["mutants", "--list", "--line-col=false", "-d"]) .arg(testdata.path()) .args(["--exclude-regex", " -> "]) .args(["-f", "src/simple_fns.rs"]) .assert() .success() .stdout(indoc! {" - src/simple_fns.rs:7: replace returns_unit with () + src/simple_fns.rs: replace returns_unit with () + src/simple_fns.rs: replace == with != in divisible_by_three "}); } diff --git a/tests/cli/error_value.rs b/tests/cli/error_value.rs index 52751426..8ece316e 100644 --- a/tests/cli/error_value.rs +++ b/tests/cli/error_value.rs @@ -96,11 +96,11 @@ fn warn_if_error_value_starts_with_err() { "error_value option gives the value of the error, and probably should not start with Err(: got Err(anyhow!(\"mutant\"))" )) .stdout(indoc! { "\ - src/lib.rs:3: replace even_is_ok -> Result with Ok(0) - src/lib.rs:3: replace even_is_ok -> Result with Ok(1) - src/lib.rs:3: replace even_is_ok -> Result with Err(Err(anyhow!(\"mutant\"))) - " - }); + src/lib.rs:4:5: replace even_is_ok -> Result with Ok(0) + src/lib.rs:4:5: replace even_is_ok -> Result with Ok(1) + src/lib.rs:4:5: replace even_is_ok -> Result with Err(Err(anyhow!(\"mutant\"))) + src/lib.rs:4:14: replace == with != in even_is_ok + " }); } #[test] diff --git a/tests/cli/in_diff.rs b/tests/cli/in_diff.rs index 731b5ed6..51e8f9b0 100644 --- a/tests/cli/in_diff.rs +++ b/tests/cli/in_diff.rs @@ -50,8 +50,8 @@ fn list_mutants_changed_in_diff1() { assert_eq!( read_to_string(tmp.path().join("mutants.out/caught.txt")).unwrap(), indoc! { "\ - src/lib.rs:5: replace two -> String with String::new() - src/lib.rs:5: replace two -> String with \"xyzzy\".into() + src/lib.rs:6:5: replace two -> String with String::new() + src/lib.rs:6:5: replace two -> String with \"xyzzy\".into() "} ); diff --git a/tests/cli/main.rs b/tests/cli/main.rs index a33f2ef5..009bc616 100644 --- a/tests/cli/main.rs +++ b/tests/cli/main.rs @@ -390,11 +390,13 @@ fn list_mutants_regex_anchored_matches_full_line() { .args([ "--list", "--re", - r"^src/simple_fns.rs:\d+: replace returns_unit with \(\)$", + r"^src/simple_fns.rs:\d+:\d+: replace returns_unit with \(\)$", ]) .arg("-d") .arg("testdata/well_tested") - .assert_insta("list_mutants_regex_anchored_matches_full_line"); + .assert() + .success() + .stdout("src/simple_fns.rs:8:5: replace returns_unit with ()\n"); } #[test] @@ -504,7 +506,7 @@ fn small_well_tested_tree_is_clean() { let log_content = fs::read_to_string( tmp_src_dir .path() - .join("mutants.out/log/src__lib.rs_line_4.log"), + .join("mutants.out/log/src__lib.rs_line_5.log"), ) .unwrap() .replace('\r', ""); @@ -523,7 +525,7 @@ fn small_well_tested_tree_is_clean() { - a *= i; - } - a - +0 /* ~ changed by cargo-mutants ~ */ + + 0 /* ~ changed by cargo-mutants ~ */ } "# })); // Also, it should contain output from the failed tests with mutations applied. @@ -566,8 +568,8 @@ fn well_tested_tree_quiet() { fs::read_to_string(tmp_src_dir.path().join("mutants.out/outcomes.json")).unwrap(); println!("outcomes.json:\n{outcomes_json}"); let outcomes: serde_json::Value = outcomes_json.parse().unwrap(); - assert_eq!(outcomes["total_mutants"], 38); - assert_eq!(outcomes["caught"], 38); + assert_eq!(outcomes["total_mutants"], 43); + assert_eq!(outcomes["caught"], 43); assert_eq!(outcomes["unviable"], 0); assert_eq!(outcomes["missed"], 0); } @@ -623,14 +625,21 @@ fn well_tested_tree_check_only_shuffled() { fn unviable_mutation_of_struct_with_no_default() { let tmp_src_dir = copy_of_testdata("struct_with_no_default"); run() - .args(["mutants", "--no-times", "--no-shuffle", "-v", "-V"]) + .args([ + "mutants", + "--line-col=false", + "--no-times", + "--no-shuffle", + "-v", + "-V", + ]) .arg("-d") .arg(tmp_src_dir.path()) .assert() .success() .stdout( predicate::str::is_match( - r"src/lib.rs:\d+: replace make_an_s -> S with Default::default\(\) \.\.\. unviable", + r"src/lib.rs:\d+:\d+: replace make_an_s -> S with Default::default\(\) \.\.\. unviable", ) .unwrap(), ); @@ -725,10 +734,10 @@ fn factorial_mutants_with_all_logs() { r"Unmutated baseline \.\.\. ok in \d+\.\ds" ).unwrap()) .stdout(is_match( -r"src/bin/factorial\.rs:1: replace main with \(\) \.\.\. NOT CAUGHT in \d+\.\ds" +r"src/bin/factorial\.rs:\d+:\d+: replace main with \(\) \.\.\. NOT CAUGHT in \d+\.\ds" ).unwrap()) .stdout(is_match( -r"src/bin/factorial\.rs:7: replace factorial -> u32 with 0 \.\.\. caught in \d+\.\ds" +r"src/bin/factorial\.rs:\d+:\d+: replace factorial -> u32 with 0 \.\.\. caught in \d+\.\ds" ).unwrap()); } diff --git a/tests/cli/snapshots/cli__cargo_mutants_in_override_dependency_tree_passes.snap b/tests/cli/snapshots/cli__cargo_mutants_in_override_dependency_tree_passes.snap index a8b6c2a6..5fd1648a 100644 --- a/tests/cli/snapshots/cli__cargo_mutants_in_override_dependency_tree_passes.snap +++ b/tests/cli/snapshots/cli__cargo_mutants_in_override_dependency_tree_passes.snap @@ -1,8 +1,8 @@ --- -source: tests/cli.rs +source: tests/cli/main.rs expression: stdout --- -Found 2 mutants to test +Found 3 mutants to test Unmutated baseline ... ok -2 mutants tested: 2 caught +3 mutants tested: 3 caught diff --git a/tests/cli/snapshots/cli__cargo_mutants_in_patch_dependency_tree_passes.snap b/tests/cli/snapshots/cli__cargo_mutants_in_patch_dependency_tree_passes.snap index a8b6c2a6..5fd1648a 100644 --- a/tests/cli/snapshots/cli__cargo_mutants_in_patch_dependency_tree_passes.snap +++ b/tests/cli/snapshots/cli__cargo_mutants_in_patch_dependency_tree_passes.snap @@ -1,8 +1,8 @@ --- -source: tests/cli.rs +source: tests/cli/main.rs expression: stdout --- -Found 2 mutants to test +Found 3 mutants to test Unmutated baseline ... ok -2 mutants tested: 2 caught +3 mutants tested: 3 caught diff --git a/tests/cli/snapshots/cli__cargo_mutants_in_replace_dependency_tree_passes.snap b/tests/cli/snapshots/cli__cargo_mutants_in_replace_dependency_tree_passes.snap index a8b6c2a6..5fd1648a 100644 --- a/tests/cli/snapshots/cli__cargo_mutants_in_replace_dependency_tree_passes.snap +++ b/tests/cli/snapshots/cli__cargo_mutants_in_replace_dependency_tree_passes.snap @@ -1,8 +1,8 @@ --- -source: tests/cli.rs +source: tests/cli/main.rs expression: stdout --- -Found 2 mutants to test +Found 3 mutants to test Unmutated baseline ... ok -2 mutants tested: 2 caught +3 mutants tested: 3 caught diff --git a/tests/cli/snapshots/cli__cdylib_tree_is_well_tested.snap b/tests/cli/snapshots/cli__cdylib_tree_is_well_tested.snap index 915ef386..f559e4ca 100644 --- a/tests/cli/snapshots/cli__cdylib_tree_is_well_tested.snap +++ b/tests/cli/snapshots/cli__cdylib_tree_is_well_tested.snap @@ -4,7 +4,7 @@ expression: stdout --- Found 2 mutants to test Unmutated baseline ... ok -src/entry.rs:1: replace factorial -> u32 with 0 ... caught -src/entry.rs:1: replace factorial -> u32 with 1 ... caught +src/entry.rs:2:5: replace factorial -> u32 with 0 ... caught +src/entry.rs:2:5: replace factorial -> u32 with 1 ... caught 2 mutants tested: 2 caught diff --git a/tests/cli/snapshots/cli__check_succeeds_in_tree_that_builds_but_fails_tests.snap b/tests/cli/snapshots/cli__check_succeeds_in_tree_that_builds_but_fails_tests.snap index d967f2a4..2672b421 100644 --- a/tests/cli/snapshots/cli__check_succeeds_in_tree_that_builds_but_fails_tests.snap +++ b/tests/cli/snapshots/cli__check_succeeds_in_tree_that_builds_but_fails_tests.snap @@ -4,7 +4,7 @@ expression: stdout --- Found 2 mutants to test Unmutated baseline ... ok -src/lib.rs:1: replace factorial -> u32 with 0 ... ok -src/lib.rs:1: replace factorial -> u32 with 1 ... ok +src/lib.rs:2:5: replace factorial -> u32 with 0 ... ok +src/lib.rs:2:5: replace factorial -> u32 with 1 ... ok 2 mutants tested: 2 succeeded diff --git a/tests/cli/snapshots/cli__check_tree_with_mutants_skip.snap b/tests/cli/snapshots/cli__check_tree_with_mutants_skip.snap index efef415e..535e2503 100644 --- a/tests/cli/snapshots/cli__check_tree_with_mutants_skip.snap +++ b/tests/cli/snapshots/cli__check_tree_with_mutants_skip.snap @@ -1,9 +1,9 @@ --- -source: tests/cli.rs +source: tests/cli/main.rs expression: stdout --- Found 1 mutant to test Unmutated baseline ... ok -src/lib.rs:14: replace controlled_loop with () ... ok +src/lib.rs:15:5: replace controlled_loop with () ... ok 1 mutant tested: 1 succeeded diff --git a/tests/cli/snapshots/cli__error_value__error_value_catches_untested_ok_case.snap b/tests/cli/snapshots/cli__error_value__error_value_catches_untested_ok_case.snap index bce07292..ad84d66d 100644 --- a/tests/cli/snapshots/cli__error_value__error_value_catches_untested_ok_case.snap +++ b/tests/cli/snapshots/cli__error_value__error_value_catches_untested_ok_case.snap @@ -2,10 +2,11 @@ source: tests/cli/error_value.rs expression: stdout --- -Found 3 mutants to test +Found 4 mutants to test Unmutated baseline ... ok -src/lib.rs:3: replace even_is_ok -> Result with Ok(0) ... caught -src/lib.rs:3: replace even_is_ok -> Result with Ok(1) ... caught -src/lib.rs:3: replace even_is_ok -> Result with Err("injected") ... NOT CAUGHT -3 mutants tested: 1 missed, 2 caught +src/lib.rs:4:5: replace even_is_ok -> Result with Ok(0) ... caught +src/lib.rs:4:5: replace even_is_ok -> Result with Ok(1) ... caught +src/lib.rs:4:5: replace even_is_ok -> Result with Err("injected") ... NOT CAUGHT +src/lib.rs:4:14: replace == with != in even_is_ok ... caught +4 mutants tested: 1 missed, 3 caught diff --git a/tests/cli/snapshots/cli__error_value__list_mutants_with_error_value_from_command_line_list.snap b/tests/cli/snapshots/cli__error_value__list_mutants_with_error_value_from_command_line_list.snap index fc7e8ed5..424d11c0 100644 --- a/tests/cli/snapshots/cli__error_value__list_mutants_with_error_value_from_command_line_list.snap +++ b/tests/cli/snapshots/cli__error_value__list_mutants_with_error_value_from_command_line_list.snap @@ -2,7 +2,8 @@ source: tests/cli/error_value.rs expression: stdout --- -src/lib.rs:3: replace even_is_ok -> Result with Ok(0) -src/lib.rs:3: replace even_is_ok -> Result with Ok(1) -src/lib.rs:3: replace even_is_ok -> Result with Err(::eyre::eyre!("mutant")) +src/lib.rs:4:5: replace even_is_ok -> Result with Ok(0) +src/lib.rs:4:5: replace even_is_ok -> Result with Ok(1) +src/lib.rs:4:5: replace even_is_ok -> Result with Err(::eyre::eyre!("mutant")) +src/lib.rs:4:14: replace == with != in even_is_ok diff --git a/tests/cli/snapshots/cli__error_value__no_config_option_disables_config_file_so_error_value_is_not_generated.snap b/tests/cli/snapshots/cli__error_value__no_config_option_disables_config_file_so_error_value_is_not_generated.snap index fd4d3478..b196fa54 100644 --- a/tests/cli/snapshots/cli__error_value__no_config_option_disables_config_file_so_error_value_is_not_generated.snap +++ b/tests/cli/snapshots/cli__error_value__no_config_option_disables_config_file_so_error_value_is_not_generated.snap @@ -2,9 +2,10 @@ source: tests/cli/error_value.rs expression: stdout --- -Found 2 mutants to test +Found 3 mutants to test Unmutated baseline ... ok -src/lib.rs:3: replace even_is_ok -> Result with Ok(0) ... caught -src/lib.rs:3: replace even_is_ok -> Result with Ok(1) ... caught -2 mutants tested: 2 caught +src/lib.rs:4:5: replace even_is_ok -> Result with Ok(0) ... caught +src/lib.rs:4:5: replace even_is_ok -> Result with Ok(1) ... caught +src/lib.rs:4:14: replace == with != in even_is_ok ... caught +3 mutants tested: 3 caught diff --git a/tests/cli/snapshots/cli__factorial__log_names.snap b/tests/cli/snapshots/cli__factorial__log_names.snap index 5c97a1d1..a608a2c5 100644 --- a/tests/cli/snapshots/cli__factorial__log_names.snap +++ b/tests/cli/snapshots/cli__factorial__log_names.snap @@ -4,7 +4,7 @@ expression: "&names" --- [ "baseline.log", - "src__bin__factorial.rs_line_1.log", - "src__bin__factorial.rs_line_7.log", - "src__bin__factorial.rs_line_7_001.log", + "src__bin__factorial.rs_line_2.log", + "src__bin__factorial.rs_line_8.log", + "src__bin__factorial.rs_line_8_001.log", ] diff --git a/tests/cli/snapshots/cli__factorial_mutants_no_copy_target.snap b/tests/cli/snapshots/cli__factorial_mutants_no_copy_target.snap index 440bc584..c8255a5d 100644 --- a/tests/cli/snapshots/cli__factorial_mutants_no_copy_target.snap +++ b/tests/cli/snapshots/cli__factorial_mutants_no_copy_target.snap @@ -4,6 +4,6 @@ expression: stdout --- Found 3 mutants to test Unmutated baseline ... ok -src/bin/factorial.rs:1: replace main with () ... NOT CAUGHT +src/bin/factorial.rs:2:5: replace main with () ... NOT CAUGHT 3 mutants tested: 1 missed, 2 caught diff --git a/tests/cli/snapshots/cli__integration_test_source_is_not_mutated__caught.txt.snap b/tests/cli/snapshots/cli__integration_test_source_is_not_mutated__caught.txt.snap index 503756ba..22db05b6 100644 --- a/tests/cli/snapshots/cli__integration_test_source_is_not_mutated__caught.txt.snap +++ b/tests/cli/snapshots/cli__integration_test_source_is_not_mutated__caught.txt.snap @@ -2,6 +2,6 @@ source: tests/cli/main.rs expression: content --- -src/lib.rs:1: replace double -> u32 with 0 -src/lib.rs:1: replace double -> u32 with 1 +src/lib.rs:2:5: replace double -> u32 with 0 +src/lib.rs:2:5: replace double -> u32 with 1 diff --git a/tests/cli/snapshots/cli__list_files_json_well_tested.snap b/tests/cli/snapshots/cli__list_files_json_well_tested.snap index 5d05108a..bc033b4e 100644 --- a/tests/cli/snapshots/cli__list_files_json_well_tested.snap +++ b/tests/cli/snapshots/cli__list_files_json_well_tested.snap @@ -51,6 +51,10 @@ expression: "String::from_utf8_lossy(&output.stdout)" "package": "cargo-mutants-testdata-well-tested", "path": "src/slices.rs" }, + { + "package": "cargo-mutants-testdata-well-tested", + "path": "src/static_item.rs" + }, { "package": "cargo-mutants-testdata-well-tested", "path": "src/struct_with_lifetime.rs" diff --git a/tests/cli/snapshots/cli__list_files_text_well_tested.snap b/tests/cli/snapshots/cli__list_files_text_well_tested.snap index 61c635a8..a17c9e27 100644 --- a/tests/cli/snapshots/cli__list_files_text_well_tested.snap +++ b/tests/cli/snapshots/cli__list_files_text_well_tested.snap @@ -14,5 +14,6 @@ src/result.rs src/sets.rs src/simple_fns.rs src/slices.rs +src/static_item.rs src/struct_with_lifetime.rs diff --git a/tests/cli/snapshots/cli__list_mutants_in_all_trees_as_json.snap b/tests/cli/snapshots/cli__list_mutants_in_all_trees_as_json.snap index 1e05edec..0b5688df 100644 --- a/tests/cli/snapshots/cli__list_mutants_in_all_trees_as_json.snap +++ b/tests/cli/snapshots/cli__list_mutants_in_all_trees_as_json.snap @@ -8,21 +8,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "takes_one_arg", + "function": { + "function_name": "takes_one_arg", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 11 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 9, "package": "mutants-testdata-already-failing-doctests", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 10 + }, + "start": { + "column": 5, + "line": 10 + } + } }, { "file": "src/lib.rs", - "function": "takes_one_arg", + "function": { + "function_name": "takes_one_arg", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 11 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 9, "package": "mutants-testdata-already-failing-doctests", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 10 + }, + "start": { + "column": 5, + "line": 10 + } + } } ] ``` @@ -33,21 +75,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "mutants-testdata-already-failing-tests", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 6 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/lib.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "mutants-testdata-already-failing-tests", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 6 + }, + "start": { + "column": 5, + "line": 2 + } + } } ] ``` @@ -58,12 +142,33 @@ expression: buf [ { "file": "src/lib.rs", - "function": "infinite_loop", + "function": { + "function_name": "infinite_loop", + "return_type": "", + "span": { + "end": { + "column": 2, + "line": 16 + }, + "start": { + "column": 1, + "line": 8 + } + } + }, "genre": "FnValue", - "line": 8, "package": "cargo-mutants-testdata-already-hangs", "replacement": "()", - "return_type": "" + "span": { + "end": { + "column": 6, + "line": 15 + }, + "start": { + "column": 5, + "line": 12 + } + } } ] ``` @@ -74,21 +179,63 @@ expression: buf [ { "file": "src/entry.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-cdylib", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 6 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/entry.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-cdylib", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 6 + }, + "start": { + "column": 5, + "line": 2 + } + } } ] ``` @@ -105,21 +252,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-cfg-attr-test-skip", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } }, { "file": "src/lib.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-cfg-attr-test-skip", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } } ] ``` @@ -130,21 +319,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-dependency", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 6 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/lib.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-dependency", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 6 + }, + "start": { + "column": 5, + "line": 2 + } + } } ] ``` @@ -155,21 +386,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "diff0", "replacement": "String::new()", - "return_type": "-> String" + "span": { + "end": { + "column": 21, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/lib.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "diff0", "replacement": "\"xyzzy\".into()", - "return_type": "-> String" + "span": { + "end": { + "column": 21, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } } ] ``` @@ -180,39 +453,123 @@ expression: buf [ { "file": "src/lib.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "diff1", "replacement": "String::new()", - "return_type": "-> String" + "span": { + "end": { + "column": 21, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/lib.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "diff1", "replacement": "\"xyzzy\".into()", - "return_type": "-> String" + "span": { + "end": { + "column": 21, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/lib.rs", - "function": "two", + "function": { + "function_name": "two", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, "genre": "FnValue", - "line": 5, "package": "diff1", "replacement": "String::new()", - "return_type": "-> String" + "span": { + "end": { + "column": 21, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } }, { "file": "src/lib.rs", - "function": "two", + "function": { + "function_name": "two", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, "genre": "FnValue", - "line": 5, "package": "diff1", "replacement": "\"xyzzy\".into()", - "return_type": "-> String" + "span": { + "end": { + "column": 21, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } } ] ``` @@ -223,30 +580,123 @@ expression: buf [ { "file": "src/lib.rs", - "function": "even_is_ok", + "function": { + "function_name": "even_is_ok", + "return_type": "-> Result", + "span": { + "end": { + "column": 2, + "line": 9 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-error-value", "replacement": "Ok(0)", - "return_type": "-> Result" + "span": { + "end": { + "column": 6, + "line": 8 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/lib.rs", - "function": "even_is_ok", + "function": { + "function_name": "even_is_ok", + "return_type": "-> Result", + "span": { + "end": { + "column": 2, + "line": 9 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-error-value", "replacement": "Ok(1)", - "return_type": "-> Result" + "span": { + "end": { + "column": 6, + "line": 8 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/lib.rs", - "function": "even_is_ok", + "function": { + "function_name": "even_is_ok", + "return_type": "-> Result", + "span": { + "end": { + "column": 2, + "line": 9 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-error-value", "replacement": "Err(\"injected\")", - "return_type": "-> Result" + "span": { + "end": { + "column": 6, + "line": 8 + }, + "start": { + "column": 5, + "line": 4 + } + } + }, + { + "file": "src/lib.rs", + "function": { + "function_name": "even_is_ok", + "return_type": "-> Result", + "span": { + "end": { + "column": 2, + "line": 9 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-error-value", + "replacement": "!=", + "span": { + "end": { + "column": 16, + "line": 4 + }, + "start": { + "column": 14, + "line": 4 + } + } } ] ``` @@ -263,30 +713,93 @@ expression: buf [ { "file": "src/bin/factorial.rs", - "function": "main", + "function": { + "function_name": "main", + "return_type": "", + "span": { + "end": { + "column": 2, + "line": 5 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-factorial", "replacement": "()", - "return_type": "" + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/bin/factorial.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 13 + }, + "start": { + "column": 1, + "line": 7 + } + } + }, "genre": "FnValue", - "line": 7, "package": "cargo-mutants-testdata-factorial", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 12 + }, + "start": { + "column": 5, + "line": 8 + } + } }, { "file": "src/bin/factorial.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 13 + }, + "start": { + "column": 1, + "line": 7 + } + } + }, "genre": "FnValue", - "line": 7, "package": "cargo-mutants-testdata-factorial", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 12 + }, + "start": { + "column": 5, + "line": 8 + } + } } ] ``` @@ -297,21 +810,63 @@ expression: buf [ { "file": "src/bin/factorial.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 15 + }, + "start": { + "column": 1, + "line": 8 + } + } + }, "genre": "FnValue", - "line": 9, "package": "cargo-mutants-testdata-fails-without-feature", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 14 + }, + "start": { + "column": 5, + "line": 10 + } + } }, { "file": "src/bin/factorial.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 15 + }, + "start": { + "column": 1, + "line": 8 + } + } + }, "genre": "FnValue", - "line": 9, "package": "cargo-mutants-testdata-fails-without-feature", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 14 + }, + "start": { + "column": 5, + "line": 10 + } + } } ] ``` @@ -322,12 +877,33 @@ expression: buf [ { "file": "src/lib.rs", - "function": "controlled_loop", + "function": { + "function_name": "controlled_loop", + "return_type": "", + "span": { + "end": { + "column": 2, + "line": 25 + }, + "start": { + "column": 1, + "line": 14 + } + } + }, "genre": "FnValue", - "line": 14, "package": "cargo-mutants-testdata-hang-avoided-by-attr", "replacement": "()", - "return_type": "" + "span": { + "end": { + "column": 6, + "line": 24 + }, + "start": { + "column": 5, + "line": 15 + } + } } ] ``` @@ -338,39 +914,123 @@ expression: buf [ { "file": "src/lib.rs", - "function": "should_stop", + "function": { + "function_name": "should_stop", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 18 + }, + "start": { + "column": 1, + "line": 11 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-hang-when-mutated", "replacement": "true", - "return_type": "-> bool" + "span": { + "end": { + "column": 10, + "line": 17 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/lib.rs", - "function": "should_stop", + "function": { + "function_name": "should_stop", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 18 + }, + "start": { + "column": 1, + "line": 11 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-hang-when-mutated", "replacement": "false", - "return_type": "-> bool" + "span": { + "end": { + "column": 10, + "line": 17 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/lib.rs", - "function": "controlled_loop", + "function": { + "function_name": "controlled_loop", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 38 + }, + "start": { + "column": 1, + "line": 20 + } + } + }, "genre": "FnValue", - "line": 25, "package": "cargo-mutants-testdata-hang-when-mutated", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 20, + "line": 37 + }, + "start": { + "column": 5, + "line": 26 + } + } }, { "file": "src/lib.rs", - "function": "controlled_loop", + "function": { + "function_name": "controlled_loop", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 38 + }, + "start": { + "column": 1, + "line": 20 + } + } + }, "genre": "FnValue", - "line": 25, "package": "cargo-mutants-testdata-hang-when-mutated", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 20, + "line": 37 + }, + "start": { + "column": 5, + "line": 26 + } + } } ] ``` @@ -381,21 +1041,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "say_hello", + "function": { + "function_name": "say_hello", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-insta", "replacement": "String::new()", - "return_type": "-> String" + "span": { + "end": { + "column": 30, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/lib.rs", - "function": "say_hello", + "function": { + "function_name": "say_hello", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-insta", "replacement": "\"xyzzy\".into()", - "return_type": "-> String" + "span": { + "end": { + "column": 30, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } } ] ``` @@ -406,21 +1108,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-integration-tests", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/lib.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-integration-tests", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } } ] ``` @@ -431,21 +1175,93 @@ expression: buf [ { "file": "src/lib.rs", - "function": "is_symlink", + "function": { + "function_name": "is_symlink", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-missing-test", "replacement": "true", - "return_type": "-> bool" + "span": { + "end": { + "column": 30, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/lib.rs", - "function": "is_symlink", + "function": { + "function_name": "is_symlink", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-missing-test", "replacement": "false", - "return_type": "-> bool" + "span": { + "end": { + "column": 30, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, + { + "file": "src/lib.rs", + "function": { + "function_name": "is_symlink", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-missing-test", + "replacement": "==", + "span": { + "end": { + "column": 28, + "line": 2 + }, + "start": { + "column": 26, + "line": 2 + } + } } ] ``` @@ -456,21 +1272,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "returns_mut_ref", + "function": { + "function_name": "returns_mut_ref", + "return_type": "-> &mut u32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-mut-ref", "replacement": "Box::leak(Box::new(0))", - "return_type": "-> &mut u32" + "span": { + "end": { + "column": 26, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/lib.rs", - "function": "returns_mut_ref", + "function": { + "function_name": "returns_mut_ref", + "return_type": "-> &mut u32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-mut-ref", "replacement": "Box::leak(Box::new(1))", - "return_type": "-> &mut u32" + "span": { + "end": { + "column": 26, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } } ] ``` @@ -487,30 +1345,93 @@ expression: buf [ { "file": "src/lib.rs", - "function": "box_an_int", + "function": { + "function_name": "box_an_int", + "return_type": "-> Box", + "span": { + "end": { + "column": 2, + "line": 4 + }, + "start": { + "column": 1, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "nightly_only", "replacement": "Box::new(0)", - "return_type": "-> Box" + "span": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 5, + "line": 3 + } + } }, { "file": "src/lib.rs", - "function": "box_an_int", + "function": { + "function_name": "box_an_int", + "return_type": "-> Box", + "span": { + "end": { + "column": 2, + "line": 4 + }, + "start": { + "column": 1, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "nightly_only", "replacement": "Box::new(1)", - "return_type": "-> Box" + "span": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 5, + "line": 3 + } + } }, { "file": "src/lib.rs", - "function": "box_an_int", + "function": { + "function_name": "box_an_int", + "return_type": "-> Box", + "span": { + "end": { + "column": 2, + "line": 4 + }, + "start": { + "column": 1, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "nightly_only", "replacement": "Box::new(-1)", - "return_type": "-> Box" + "span": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 5, + "line": 3 + } + } } ] ``` @@ -521,21 +1442,93 @@ expression: buf [ { "file": "src/lib.rs", - "function": "is_even", + "function": { + "function_name": "is_even", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 6 + } + } + }, "genre": "FnValue", - "line": 6, "package": "cargo-mutants-testdata-override-dependency", "replacement": "true", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 7 + }, + "start": { + "column": 5, + "line": 7 + } + } }, { "file": "src/lib.rs", - "function": "is_even", + "function": { + "function_name": "is_even", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 6 + } + } + }, "genre": "FnValue", - "line": 6, "package": "cargo-mutants-testdata-override-dependency", "replacement": "false", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 7 + }, + "start": { + "column": 5, + "line": 7 + } + } + }, + { + "file": "src/lib.rs", + "function": { + "function_name": "is_even", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 6 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-override-dependency", + "replacement": "!=", + "span": { + "end": { + "column": 13, + "line": 7 + }, + "start": { + "column": 11, + "line": 7 + } + } } ] ``` @@ -546,39 +1539,123 @@ expression: buf [ { "file": "failing/src/lib.rs", - "function": "triple", + "function": { + "function_name": "triple", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-package-fails-failing", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "failing/src/lib.rs", - "function": "triple", + "function": { + "function_name": "triple", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-package-fails-failing", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "passing/src/lib.rs", - "function": "triple", + "function": { + "function_name": "triple", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-package-fails-passing", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "passing/src/lib.rs", - "function": "triple", + "function": { + "function_name": "triple", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-package-fails-passing", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } } ] ``` @@ -589,21 +1666,93 @@ expression: buf [ { "file": "src/lib.rs", - "function": "is_even", + "function": { + "function_name": "is_even", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 6 + } + } + }, "genre": "FnValue", - "line": 6, "package": "cargo-mutants-testdata-patch-dependency", "replacement": "true", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 7 + }, + "start": { + "column": 5, + "line": 7 + } + } }, { "file": "src/lib.rs", - "function": "is_even", + "function": { + "function_name": "is_even", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 6 + } + } + }, "genre": "FnValue", - "line": 6, "package": "cargo-mutants-testdata-patch-dependency", "replacement": "false", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 7 + }, + "start": { + "column": 5, + "line": 7 + } + } + }, + { + "file": "src/lib.rs", + "function": { + "function_name": "is_even", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 6 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-patch-dependency", + "replacement": "!=", + "span": { + "end": { + "column": 13, + "line": 7 + }, + "start": { + "column": 11, + "line": 7 + } + } } ] ``` @@ -614,21 +1763,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "double_factorial", + "function": { + "function_name": "double_factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, "genre": "FnValue", - "line": 5, "package": "cargo-mutants-testdata-relative-dependency", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 41, + "line": 9 + }, + "start": { + "column": 5, + "line": 6 + } + } }, { "file": "src/lib.rs", - "function": "double_factorial", + "function": { + "function_name": "double_factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, "genre": "FnValue", - "line": 5, "package": "cargo-mutants-testdata-relative-dependency", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 41, + "line": 9 + }, + "start": { + "column": 5, + "line": 6 + } + } } ] ``` @@ -639,21 +1830,93 @@ expression: buf [ { "file": "src/lib.rs", - "function": "is_even", + "function": { + "function_name": "is_even", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 6 + } + } + }, "genre": "FnValue", - "line": 6, "package": "cargo-mutants-testdata-replace-dependency", "replacement": "true", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 7 + }, + "start": { + "column": 5, + "line": 7 + } + } }, { "file": "src/lib.rs", - "function": "is_even", + "function": { + "function_name": "is_even", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 6 + } + } + }, "genre": "FnValue", - "line": 6, "package": "cargo-mutants-testdata-replace-dependency", "replacement": "false", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 7 + }, + "start": { + "column": 5, + "line": 7 + } + } + }, + { + "file": "src/lib.rs", + "function": { + "function_name": "is_even", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 6 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-replace-dependency", + "replacement": "!=", + "span": { + "end": { + "column": 13, + "line": 7 + }, + "start": { + "column": 11, + "line": 7 + } + } } ] ``` @@ -664,21 +1927,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 4 + } + } + }, "genre": "FnValue", - "line": 4, "package": "cargo-mutants-testdata-small-well-tested", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 9 + }, + "start": { + "column": 5, + "line": 5 + } + } }, { "file": "src/lib.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 4 + } + } + }, "genre": "FnValue", - "line": 4, "package": "cargo-mutants-testdata-small-well-tested", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 9 + }, + "start": { + "column": 5, + "line": 5 + } + } } ] ``` @@ -689,21 +1994,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "some_fn", + "function": { + "function_name": "some_fn", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, "genre": "FnValue", - "line": 5, "package": "cargo-mutants-testdata-strict-warnings", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } }, { "file": "src/lib.rs", - "function": "some_fn", + "function": { + "function_name": "some_fn", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, "genre": "FnValue", - "line": 5, "package": "cargo-mutants-testdata-strict-warnings", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } } ] ``` @@ -714,12 +2061,33 @@ expression: buf [ { "file": "src/lib.rs", - "function": "make_an_s", + "function": { + "function_name": "make_an_s", + "return_type": "-> S", + "span": { + "end": { + "column": 2, + "line": 16 + }, + "start": { + "column": 1, + "line": 11 + } + } + }, "genre": "FnValue", - "line": 11, "package": "cargo-mutants-testdata-struct-with-no-default", "replacement": "Default::default()", - "return_type": "-> S" + "span": { + "end": { + "column": 6, + "line": 15 + }, + "start": { + "column": 5, + "line": 12 + } + } } ] ``` @@ -730,21 +2098,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "read_through_symlink", + "function": { + "function_name": "read_through_symlink", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-symlink", "replacement": "String::new()", - "return_type": "-> String" + "span": { + "end": { + "column": 43, + "line": 6 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/lib.rs", - "function": "read_through_symlink", + "function": { + "function_name": "read_through_symlink", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-symlink", "replacement": "\"xyzzy\".into()", - "return_type": "-> String" + "span": { + "end": { + "column": 43, + "line": 6 + }, + "start": { + "column": 5, + "line": 4 + } + } } ] ``` @@ -755,21 +2165,63 @@ expression: buf [ { "file": "src/lib.rs", - "function": "try_value_coercion", + "function": { + "function_name": "try_value_coercion", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, "genre": "FnValue", - "line": 5, "package": "mutants-testdata-typecheck-fails", "replacement": "String::new()", - "return_type": "-> String" + "span": { + "end": { + "column": 12, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } }, { "file": "src/lib.rs", - "function": "try_value_coercion", + "function": { + "function_name": "try_value_coercion", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, "genre": "FnValue", - "line": 5, "package": "mutants-testdata-typecheck-fails", "replacement": "\"xyzzy\".into()", - "return_type": "-> String" + "span": { + "end": { + "column": 12, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } } ] ``` @@ -780,84 +2232,273 @@ expression: buf [ { "file": "src/a.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-unapply", "replacement": "0", - "return_type": "-> i32" + "span": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/a.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-unapply", "replacement": "1", - "return_type": "-> i32" + "span": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/a.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-unapply", "replacement": "-1", - "return_type": "-> i32" + "span": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/b.rs", - "function": "one_untested", + "function": { + "function_name": "one_untested", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-unapply", "replacement": "0", - "return_type": "-> i32" + "span": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/b.rs", - "function": "one_untested", + "function": { + "function_name": "one_untested", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-unapply", "replacement": "1", - "return_type": "-> i32" + "span": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/b.rs", - "function": "one_untested", + "function": { + "function_name": "one_untested", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-unapply", "replacement": "-1", - "return_type": "-> i32" + "span": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/c.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-unapply", "replacement": "0", - "return_type": "-> i32" + "span": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/c.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-unapply", "replacement": "1", - "return_type": "-> i32" + "span": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/c.rs", - "function": "one", + "function": { + "function_name": "one", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-unapply", "replacement": "-1", - "return_type": "-> i32" + "span": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } } ] ``` @@ -874,345 +2515,1280 @@ expression: buf [ { "file": "src/arc.rs", - "function": "return_arc", + "function": { + "function_name": "return_arc", + "return_type": "-> Arc", + "span": { + "end": { + "column": 2, + "line": 5 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Arc::new(String::new())", - "return_type": "-> Arc" + "span": { + "end": { + "column": 37, + "line": 4 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/arc.rs", - "function": "return_arc", + "function": { + "function_name": "return_arc", + "return_type": "-> Arc", + "span": { + "end": { + "column": 2, + "line": 5 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Arc::new(\"xyzzy\".into())", - "return_type": "-> Arc" + "span": { + "end": { + "column": 37, + "line": 4 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/inside_mod.rs", - "function": "outer::inner::name", + "function": { + "function_name": "outer::inner::name", + "return_type": "-> &'static str", + "span": { + "end": { + "column": 10, + "line": 5 + }, + "start": { + "column": 9, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "\"\"", - "return_type": "-> &'static str" + "span": { + "end": { + "column": 18, + "line": 4 + }, + "start": { + "column": 13, + "line": 4 + } + } }, { "file": "src/inside_mod.rs", - "function": "outer::inner::name", + "function": { + "function_name": "outer::inner::name", + "return_type": "-> &'static str", + "span": { + "end": { + "column": 10, + "line": 5 + }, + "start": { + "column": 9, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "\"xyzzy\"", - "return_type": "-> &'static str" + "span": { + "end": { + "column": 18, + "line": 4 + }, + "start": { + "column": 13, + "line": 4 + } + } }, { "file": "src/methods.rs", - "function": "Foo::double", + "function": { + "function_name": "Foo::double", + "return_type": "", + "span": { + "end": { + "column": 6, + "line": 18 + }, + "start": { + "column": 5, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 16, "package": "cargo-mutants-testdata-well-tested", "replacement": "()", - "return_type": "" + "span": { + "end": { + "column": 21, + "line": 17 + }, + "start": { + "column": 9, + "line": 17 + } + } }, { "file": "src/methods.rs", - "function": "::fmt", + "function": { + "function_name": "::fmt", + "return_type": "-> fmt::Result", + "span": { + "end": { + "column": 6, + "line": 24 + }, + "start": { + "column": 5, + "line": 22 + } + } + }, "genre": "FnValue", - "line": 22, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(Default::default())", - "return_type": "-> fmt::Result" + "span": { + "end": { + "column": 36, + "line": 23 + }, + "start": { + "column": 9, + "line": 23 + } + } }, { "file": "src/methods.rs", - "function": "::fmt", + "function": { + "function_name": "::fmt", + "return_type": "-> fmt::Result", + "span": { + "end": { + "column": 6, + "line": 30 + }, + "start": { + "column": 5, + "line": 28 + } + } + }, "genre": "FnValue", - "line": 28, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(Default::default())", - "return_type": "-> fmt::Result" + "span": { + "end": { + "column": 37, + "line": 29 + }, + "start": { + "column": 9, + "line": 29 + } + } }, { "file": "src/nested_function.rs", - "function": "has_nested", + "function": { + "function_name": "has_nested", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 6 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 22, + "line": 5 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/nested_function.rs", - "function": "has_nested", + "function": { + "function_name": "has_nested", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 6 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 22, + "line": 5 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/nested_function.rs", - "function": "has_nested::inner", + "function": { + "function_name": "has_nested::inner", + "return_type": "-> u32", + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "cargo-mutants-testdata-well-tested", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 11, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + } }, { "file": "src/nested_function.rs", - "function": "has_nested::inner", + "function": { + "function_name": "has_nested::inner", + "return_type": "-> u32", + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "cargo-mutants-testdata-well-tested", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 11, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + } }, { "file": "src/numbers.rs", - "function": "double_float", + "function": { + "function_name": "double_float", + "return_type": "-> f32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "0.0", - "return_type": "-> f32" + "span": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/numbers.rs", - "function": "double_float", + "function": { + "function_name": "double_float", + "return_type": "-> f32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "1.0", - "return_type": "-> f32" + "span": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/numbers.rs", - "function": "double_float", + "function": { + "function_name": "double_float", + "return_type": "-> f32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "-1.0", - "return_type": "-> f32" + "span": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, + { + "file": "src/numbers.rs", + "function": { + "function_name": "is_double", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, + "genre": "FnValue", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "true", + "span": { + "end": { + "column": 15, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } + }, + { + "file": "src/numbers.rs", + "function": { + "function_name": "is_double", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, + "genre": "FnValue", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "false", + "span": { + "end": { + "column": 15, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } + }, + { + "file": "src/numbers.rs", + "function": { + "function_name": "is_double", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "!=", + "span": { + "end": { + "column": 9, + "line": 6 + }, + "start": { + "column": 7, + "line": 6 + } + } }, { "file": "src/result.rs", - "function": "simple_result", + "function": { + "function_name": "simple_result", + "return_type": "-> Result<&'static str, ()>", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 4 + } + } + }, "genre": "FnValue", - "line": 5, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(\"\")", - "return_type": "-> Result<&'static str, ()>" + "span": { + "end": { + "column": 18, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } }, { "file": "src/result.rs", - "function": "simple_result", + "function": { + "function_name": "simple_result", + "return_type": "-> Result<&'static str, ()>", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 4 + } + } + }, "genre": "FnValue", - "line": 5, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(\"xyzzy\")", - "return_type": "-> Result<&'static str, ()>" + "span": { + "end": { + "column": 18, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } }, { "file": "src/result.rs", - "function": "error_if_negative", + "function": { + "function_name": "error_if_negative", + "return_type": "-> Result<(), ()>", + "span": { + "end": { + "column": 2, + "line": 15 + }, + "start": { + "column": 1, + "line": 9 + } + } + }, "genre": "FnValue", - "line": 9, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(())", - "return_type": "-> Result<(), ()>" + "span": { + "end": { + "column": 6, + "line": 14 + }, + "start": { + "column": 5, + "line": 10 + } + } }, { "file": "src/result.rs", - "function": "result_with_no_apparent_type_args", + "function": { + "function_name": "result_with_no_apparent_type_args", + "return_type": "-> std::fmt::Result", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 17 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(Default::default())", - "return_type": "-> std::fmt::Result" + "span": { + "end": { + "column": 28, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } }, { "file": "src/sets.rs", - "function": "make_a_set", + "function": { + "function_name": "make_a_set", + "return_type": "-> BTreeSet", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "BTreeSet::new()", - "return_type": "-> BTreeSet" + "span": { + "end": { + "column": 6, + "line": 7 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/sets.rs", - "function": "make_a_set", + "function": { + "function_name": "make_a_set", + "return_type": "-> BTreeSet", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "BTreeSet::from_iter([String::new()])", - "return_type": "-> BTreeSet" + "span": { + "end": { + "column": 6, + "line": 7 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/sets.rs", - "function": "make_a_set", + "function": { + "function_name": "make_a_set", + "return_type": "-> BTreeSet", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "BTreeSet::from_iter([\"xyzzy\".into()])", - "return_type": "-> BTreeSet" + "span": { + "end": { + "column": 6, + "line": 7 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/simple_fns.rs", - "function": "returns_unit", + "function": { + "function_name": "returns_unit", + "return_type": "", + "span": { + "end": { + "column": 2, + "line": 9 + }, + "start": { + "column": 1, + "line": 7 + } + } + }, "genre": "FnValue", - "line": 7, "package": "cargo-mutants-testdata-well-tested", "replacement": "()", - "return_type": "" + "span": { + "end": { + "column": 13, + "line": 8 + }, + "start": { + "column": 5, + "line": 8 + } + } }, { "file": "src/simple_fns.rs", - "function": "returns_42u32", + "function": { + "function_name": "returns_42u32", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 14 + }, + "start": { + "column": 1, + "line": 11 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 7, + "line": 13 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/simple_fns.rs", - "function": "returns_42u32", + "function": { + "function_name": "returns_42u32", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 14 + }, + "start": { + "column": 1, + "line": 11 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 7, + "line": 13 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/simple_fns.rs", - "function": "divisible_by_three", + "function": { + "function_name": "divisible_by_three", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-well-tested", "replacement": "true", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } }, { "file": "src/simple_fns.rs", - "function": "divisible_by_three", + "function": { + "function_name": "divisible_by_three", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-well-tested", "replacement": "false", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } + }, + { + "file": "src/simple_fns.rs", + "function": { + "function_name": "divisible_by_three", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "!=", + "span": { + "end": { + "column": 13, + "line": 18 + }, + "start": { + "column": 11, + "line": 18 + } + } }, { "file": "src/simple_fns.rs", - "function": "double_string", + "function": { + "function_name": "double_string", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 30 + }, + "start": { + "column": 1, + "line": 21 + } + } + }, "genre": "FnValue", - "line": 26, "package": "cargo-mutants-testdata-well-tested", "replacement": "String::new()", - "return_type": "-> String" + "span": { + "end": { + "column": 6, + "line": 29 + }, + "start": { + "column": 5, + "line": 27 + } + } }, { "file": "src/simple_fns.rs", - "function": "double_string", + "function": { + "function_name": "double_string", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 30 + }, + "start": { + "column": 1, + "line": 21 + } + } + }, "genre": "FnValue", - "line": 26, "package": "cargo-mutants-testdata-well-tested", "replacement": "\"xyzzy\".into()", - "return_type": "-> String" + "span": { + "end": { + "column": 6, + "line": 29 + }, + "start": { + "column": 5, + "line": 27 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(Vec::new())", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![Cow::Borrowed(\"\")])", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![Cow::Owned(\"\".to_owned())])", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![Cow::Borrowed(\"xyzzy\")])", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![Cow::Owned(\"xyzzy\".to_owned())])", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "return_mut_slice", + "function": { + "function_name": "return_mut_slice", + "return_type": "-> &mut[usize]", + "span": { + "end": { + "column": 2, + "line": 17 + }, + "start": { + "column": 1, + "line": 12 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(Vec::new())", - "return_type": "-> &mut[usize]" + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/slices.rs", - "function": "return_mut_slice", + "function": { + "function_name": "return_mut_slice", + "return_type": "-> &mut[usize]", + "span": { + "end": { + "column": 2, + "line": 17 + }, + "start": { + "column": 1, + "line": 12 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![0])", - "return_type": "-> &mut[usize]" + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/slices.rs", - "function": "return_mut_slice", + "function": { + "function_name": "return_mut_slice", + "return_type": "-> &mut[usize]", + "span": { + "end": { + "column": 2, + "line": 17 + }, + "start": { + "column": 1, + "line": 12 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![1])", - "return_type": "-> &mut[usize]" + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 13 + } + } + }, + { + "file": "src/static_item.rs", + "function": null, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "!=", + "span": { + "end": { + "column": 35, + "line": 1 + }, + "start": { + "column": 33, + "line": 1 + } + } }, { "file": "src/struct_with_lifetime.rs", - "function": "Lex<'buf>::buf_len", + "function": { + "function_name": "Lex<'buf>::buf_len", + "return_type": "-> usize", + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 14 + } + } + }, "genre": "FnValue", - "line": 14, "package": "cargo-mutants-testdata-well-tested", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 23, + "line": 15 + }, + "start": { + "column": 9, + "line": 15 + } + } }, { "file": "src/struct_with_lifetime.rs", - "function": "Lex<'buf>::buf_len", + "function": { + "function_name": "Lex<'buf>::buf_len", + "return_type": "-> usize", + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 14 + } + } + }, "genre": "FnValue", - "line": 14, "package": "cargo-mutants-testdata-well-tested", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 23, + "line": 15 + }, + "start": { + "column": 9, + "line": 15 + } + } } ] ``` @@ -1223,129 +3799,423 @@ expression: buf [ { "file": "src/methods.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/methods.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/module/module_methods.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/module/module_methods.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/module/utils/inside_mod.rs", - "function": "outer::inner::name", + "function": { + "function_name": "outer::inner::name", + "return_type": "-> &'static str", + "span": { + "end": { + "column": 10, + "line": 5 + }, + "start": { + "column": 9, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "\"\"", - "return_type": "-> &'static str" + "span": { + "end": { + "column": 18, + "line": 4 + }, + "start": { + "column": 13, + "line": 4 + } + } }, { "file": "src/module/utils/inside_mod.rs", - "function": "outer::inner::name", + "function": { + "function_name": "outer::inner::name", + "return_type": "-> &'static str", + "span": { + "end": { + "column": 10, + "line": 5 + }, + "start": { + "column": 9, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "\"xyzzy\"", - "return_type": "-> &'static str" + "span": { + "end": { + "column": 18, + "line": 4 + }, + "start": { + "column": 13, + "line": 4 + } + } }, { "file": "src/module/utils/nested_function.rs", - "function": "has_nested", + "function": { + "function_name": "has_nested", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 6 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 22, + "line": 5 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/module/utils/nested_function.rs", - "function": "has_nested", + "function": { + "function_name": "has_nested", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 6 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 22, + "line": 5 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/module/utils/nested_function.rs", - "function": "has_nested::inner", + "function": { + "function_name": "has_nested::inner", + "return_type": "-> u32", + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 11, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + } }, { "file": "src/module/utils/nested_function.rs", - "function": "has_nested::inner", + "function": { + "function_name": "has_nested::inner", + "return_type": "-> u32", + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 11, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + } }, { "file": "src/module/utils/sub_utils/subutils_nested_function.rs", - "function": "has_nested", + "function": { + "function_name": "has_nested", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 6 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 22, + "line": 5 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/module/utils/sub_utils/subutils_nested_function.rs", - "function": "has_nested", + "function": { + "function_name": "has_nested", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 6 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 22, + "line": 5 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/module/utils/sub_utils/subutils_nested_function.rs", - "function": "has_nested::inner", + "function": { + "function_name": "has_nested::inner", + "return_type": "-> u32", + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 11, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + } }, { "file": "src/module/utils/sub_utils/subutils_nested_function.rs", - "function": "has_nested::inner", + "function": { + "function_name": "has_nested::inner", + "return_type": "-> u32", + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "cargo-mutants-testdata-with-child-directories", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 11, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + } } ] ``` @@ -1356,75 +4226,243 @@ expression: buf [ { "file": "utils/src/lib.rs", - "function": "triple", + "function": { + "function_name": "triple", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo_mutants_testdata_workspace_utils", "replacement": "0", - "return_type": "-> i32" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "utils/src/lib.rs", - "function": "triple", + "function": { + "function_name": "triple", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo_mutants_testdata_workspace_utils", "replacement": "1", - "return_type": "-> i32" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "utils/src/lib.rs", - "function": "triple", + "function": { + "function_name": "triple", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo_mutants_testdata_workspace_utils", "replacement": "-1", - "return_type": "-> i32" + "span": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "main/src/main.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 17 + }, + "start": { + "column": 1, + "line": 11 + } + } + }, "genre": "FnValue", - "line": 11, "package": "main", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 12 + } + } }, { "file": "main/src/main.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 17 + }, + "start": { + "column": 1, + "line": 11 + } + } + }, "genre": "FnValue", - "line": 11, "package": "main", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 12 + } + } }, { "file": "main2/src/main.rs", - "function": "triple_3", + "function": { + "function_name": "triple_3", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 11 + }, + "start": { + "column": 1, + "line": 9 + } + } + }, "genre": "FnValue", - "line": 9, "package": "main2", "replacement": "0", - "return_type": "-> i32" + "span": { + "end": { + "column": 14, + "line": 10 + }, + "start": { + "column": 5, + "line": 10 + } + } }, { "file": "main2/src/main.rs", - "function": "triple_3", + "function": { + "function_name": "triple_3", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 11 + }, + "start": { + "column": 1, + "line": 9 + } + } + }, "genre": "FnValue", - "line": 9, "package": "main2", "replacement": "1", - "return_type": "-> i32" + "span": { + "end": { + "column": 14, + "line": 10 + }, + "start": { + "column": 5, + "line": 10 + } + } }, { "file": "main2/src/main.rs", - "function": "triple_3", + "function": { + "function_name": "triple_3", + "return_type": "-> i32", + "span": { + "end": { + "column": 2, + "line": 11 + }, + "start": { + "column": 1, + "line": 9 + } + } + }, "genre": "FnValue", - "line": 9, "package": "main2", "replacement": "-1", - "return_type": "-> i32" + "span": { + "end": { + "column": 14, + "line": 10 + }, + "start": { + "column": 5, + "line": 10 + } + } } ] ``` diff --git a/tests/cli/snapshots/cli__list_mutants_in_all_trees_as_text.snap b/tests/cli/snapshots/cli__list_mutants_in_all_trees_as_text.snap index 8cca0502..9151d57d 100644 --- a/tests/cli/snapshots/cli__list_mutants_in_all_trees_as_text.snap +++ b/tests/cli/snapshots/cli__list_mutants_in_all_trees_as_text.snap @@ -5,28 +5,28 @@ expression: buf ## testdata/already_failing_doctests ``` -src/lib.rs:9: replace takes_one_arg -> usize with 0 -src/lib.rs:9: replace takes_one_arg -> usize with 1 +src/lib.rs:10:5: replace takes_one_arg -> usize with 0 +src/lib.rs:10:5: replace takes_one_arg -> usize with 1 ``` ## testdata/already_failing_tests ``` -src/lib.rs:1: replace factorial -> u32 with 0 -src/lib.rs:1: replace factorial -> u32 with 1 +src/lib.rs:2:5: replace factorial -> u32 with 0 +src/lib.rs:2:5: replace factorial -> u32 with 1 ``` ## testdata/already_hangs ``` -src/lib.rs:8: replace infinite_loop with () +src/lib.rs:12:5: replace infinite_loop with () ``` ## testdata/cdylib ``` -src/entry.rs:1: replace factorial -> u32 with 0 -src/entry.rs:1: replace factorial -> u32 with 1 +src/entry.rs:2:5: replace factorial -> u32 with 0 +src/entry.rs:2:5: replace factorial -> u32 with 1 ``` ## testdata/cfg_attr_mutants_skip @@ -37,39 +37,40 @@ src/entry.rs:1: replace factorial -> u32 with 1 ## testdata/cfg_attr_test_skip ``` -src/lib.rs:17: replace double -> usize with 0 -src/lib.rs:17: replace double -> usize with 1 +src/lib.rs:18:5: replace double -> usize with 0 +src/lib.rs:18:5: replace double -> usize with 1 ``` ## testdata/dependency ``` -src/lib.rs:1: replace factorial -> u32 with 0 -src/lib.rs:1: replace factorial -> u32 with 1 +src/lib.rs:2:5: replace factorial -> u32 with 0 +src/lib.rs:2:5: replace factorial -> u32 with 1 ``` ## testdata/diff0 ``` -src/lib.rs:1: replace one -> String with String::new() -src/lib.rs:1: replace one -> String with "xyzzy".into() +src/lib.rs:2:5: replace one -> String with String::new() +src/lib.rs:2:5: replace one -> String with "xyzzy".into() ``` ## testdata/diff1 ``` -src/lib.rs:1: replace one -> String with String::new() -src/lib.rs:1: replace one -> String with "xyzzy".into() -src/lib.rs:5: replace two -> String with String::new() -src/lib.rs:5: replace two -> String with "xyzzy".into() +src/lib.rs:2:5: replace one -> String with String::new() +src/lib.rs:2:5: replace one -> String with "xyzzy".into() +src/lib.rs:6:5: replace two -> String with String::new() +src/lib.rs:6:5: replace two -> String with "xyzzy".into() ``` ## testdata/error_value ``` -src/lib.rs:3: replace even_is_ok -> Result with Ok(0) -src/lib.rs:3: replace even_is_ok -> Result with Ok(1) -src/lib.rs:3: replace even_is_ok -> Result with Err("injected") +src/lib.rs:4:5: replace even_is_ok -> Result with Ok(0) +src/lib.rs:4:5: replace even_is_ok -> Result with Ok(1) +src/lib.rs:4:5: replace even_is_ok -> Result with Err("injected") +src/lib.rs:4:14: replace == with != in even_is_ok ``` ## testdata/everything_skipped @@ -80,59 +81,60 @@ src/lib.rs:3: replace even_is_ok -> Result with Err("injected ## testdata/factorial ``` -src/bin/factorial.rs:1: replace main with () -src/bin/factorial.rs:7: replace factorial -> u32 with 0 -src/bin/factorial.rs:7: replace factorial -> u32 with 1 +src/bin/factorial.rs:2:5: replace main with () +src/bin/factorial.rs:8:5: replace factorial -> u32 with 0 +src/bin/factorial.rs:8:5: replace factorial -> u32 with 1 ``` ## testdata/fails_without_feature ``` -src/bin/factorial.rs:9: replace factorial -> u32 with 0 -src/bin/factorial.rs:9: replace factorial -> u32 with 1 +src/bin/factorial.rs:10:5: replace factorial -> u32 with 0 +src/bin/factorial.rs:10:5: replace factorial -> u32 with 1 ``` ## testdata/hang_avoided_by_attr ``` -src/lib.rs:14: replace controlled_loop with () +src/lib.rs:15:5: replace controlled_loop with () ``` ## testdata/hang_when_mutated ``` -src/lib.rs:12: replace should_stop -> bool with true -src/lib.rs:12: replace should_stop -> bool with false -src/lib.rs:25: replace controlled_loop -> usize with 0 -src/lib.rs:25: replace controlled_loop -> usize with 1 +src/lib.rs:13:5: replace should_stop -> bool with true +src/lib.rs:13:5: replace should_stop -> bool with false +src/lib.rs:26:5: replace controlled_loop -> usize with 0 +src/lib.rs:26:5: replace controlled_loop -> usize with 1 ``` ## testdata/insta ``` -src/lib.rs:1: replace say_hello -> String with String::new() -src/lib.rs:1: replace say_hello -> String with "xyzzy".into() +src/lib.rs:2:5: replace say_hello -> String with String::new() +src/lib.rs:2:5: replace say_hello -> String with "xyzzy".into() ``` ## testdata/integration_tests ``` -src/lib.rs:1: replace double -> u32 with 0 -src/lib.rs:1: replace double -> u32 with 1 +src/lib.rs:2:5: replace double -> u32 with 0 +src/lib.rs:2:5: replace double -> u32 with 1 ``` ## testdata/missing_test ``` -src/lib.rs:1: replace is_symlink -> bool with true -src/lib.rs:1: replace is_symlink -> bool with false +src/lib.rs:2:5: replace is_symlink -> bool with true +src/lib.rs:2:5: replace is_symlink -> bool with false +src/lib.rs:2:26: replace != with == in is_symlink ``` ## testdata/mut_ref ``` -src/lib.rs:1: replace returns_mut_ref -> &mut u32 with Box::leak(Box::new(0)) -src/lib.rs:1: replace returns_mut_ref -> &mut u32 with Box::leak(Box::new(1)) +src/lib.rs:2:5: replace returns_mut_ref -> &mut u32 with Box::leak(Box::new(0)) +src/lib.rs:2:5: replace returns_mut_ref -> &mut u32 with Box::leak(Box::new(1)) ``` ## testdata/never_type @@ -143,94 +145,97 @@ src/lib.rs:1: replace returns_mut_ref -> &mut u32 with Box::leak(Box::new(1)) ## testdata/nightly_only ``` -src/lib.rs:2: replace box_an_int -> Box with Box::new(0) -src/lib.rs:2: replace box_an_int -> Box with Box::new(1) -src/lib.rs:2: replace box_an_int -> Box with Box::new(-1) +src/lib.rs:3:5: replace box_an_int -> Box with Box::new(0) +src/lib.rs:3:5: replace box_an_int -> Box with Box::new(1) +src/lib.rs:3:5: replace box_an_int -> Box with Box::new(-1) ``` ## testdata/override_dependency ``` -src/lib.rs:6: replace is_even -> bool with true -src/lib.rs:6: replace is_even -> bool with false +src/lib.rs:7:5: replace is_even -> bool with true +src/lib.rs:7:5: replace is_even -> bool with false +src/lib.rs:7:11: replace == with != in is_even ``` ## testdata/package_fails ``` -failing/src/lib.rs:1: replace triple -> usize with 0 -failing/src/lib.rs:1: replace triple -> usize with 1 -passing/src/lib.rs:1: replace triple -> usize with 0 -passing/src/lib.rs:1: replace triple -> usize with 1 +failing/src/lib.rs:2:5: replace triple -> usize with 0 +failing/src/lib.rs:2:5: replace triple -> usize with 1 +passing/src/lib.rs:2:5: replace triple -> usize with 0 +passing/src/lib.rs:2:5: replace triple -> usize with 1 ``` ## testdata/patch_dependency ``` -src/lib.rs:6: replace is_even -> bool with true -src/lib.rs:6: replace is_even -> bool with false +src/lib.rs:7:5: replace is_even -> bool with true +src/lib.rs:7:5: replace is_even -> bool with false +src/lib.rs:7:11: replace == with != in is_even ``` ## testdata/relative_dependency ``` -src/lib.rs:5: replace double_factorial -> u32 with 0 -src/lib.rs:5: replace double_factorial -> u32 with 1 +src/lib.rs:6:5: replace double_factorial -> u32 with 0 +src/lib.rs:6:5: replace double_factorial -> u32 with 1 ``` ## testdata/replace_dependency ``` -src/lib.rs:6: replace is_even -> bool with true -src/lib.rs:6: replace is_even -> bool with false +src/lib.rs:7:5: replace is_even -> bool with true +src/lib.rs:7:5: replace is_even -> bool with false +src/lib.rs:7:11: replace == with != in is_even ``` ## testdata/small_well_tested ``` -src/lib.rs:4: replace factorial -> u32 with 0 -src/lib.rs:4: replace factorial -> u32 with 1 +src/lib.rs:5:5: replace factorial -> u32 with 0 +src/lib.rs:5:5: replace factorial -> u32 with 1 ``` ## testdata/strict_warnings ``` -src/lib.rs:5: replace some_fn -> usize with 0 -src/lib.rs:5: replace some_fn -> usize with 1 +src/lib.rs:6:5: replace some_fn -> usize with 0 +src/lib.rs:6:5: replace some_fn -> usize with 1 ``` ## testdata/struct_with_no_default ``` -src/lib.rs:11: replace make_an_s -> S with Default::default() +src/lib.rs:12:5: replace make_an_s -> S with Default::default() ``` ## testdata/symlink ``` -src/lib.rs:3: replace read_through_symlink -> String with String::new() -src/lib.rs:3: replace read_through_symlink -> String with "xyzzy".into() +src/lib.rs:4:5: replace read_through_symlink -> String with String::new() +src/lib.rs:4:5: replace read_through_symlink -> String with "xyzzy".into() ``` ## testdata/typecheck_fails ``` -src/lib.rs:5: replace try_value_coercion -> String with String::new() -src/lib.rs:5: replace try_value_coercion -> String with "xyzzy".into() +src/lib.rs:6:5: replace try_value_coercion -> String with String::new() +src/lib.rs:6:5: replace try_value_coercion -> String with "xyzzy".into() ``` ## testdata/unapply ``` -src/a.rs:1: replace one -> i32 with 0 -src/a.rs:1: replace one -> i32 with 1 -src/a.rs:1: replace one -> i32 with -1 -src/b.rs:1: replace one_untested -> i32 with 0 -src/b.rs:1: replace one_untested -> i32 with 1 -src/b.rs:1: replace one_untested -> i32 with -1 -src/c.rs:1: replace one -> i32 with 0 -src/c.rs:1: replace one -> i32 with 1 -src/c.rs:1: replace one -> i32 with -1 +src/a.rs:2:5: replace one -> i32 with 0 +src/a.rs:2:5: replace one -> i32 with 1 +src/a.rs:2:5: replace one -> i32 with -1 +src/b.rs:2:5: replace one_untested -> i32 with 0 +src/b.rs:2:5: replace one_untested -> i32 with 1 +src/b.rs:2:5: replace one_untested -> i32 with -1 +src/c.rs:2:5: replace one -> i32 with 0 +src/c.rs:2:5: replace one -> i32 with 1 +src/c.rs:2:5: replace one -> i32 with -1 ``` ## testdata/unsafe @@ -241,76 +246,81 @@ src/c.rs:1: replace one -> i32 with -1 ## testdata/well_tested ``` -src/arc.rs:3: replace return_arc -> Arc with Arc::new(String::new()) -src/arc.rs:3: replace return_arc -> Arc with Arc::new("xyzzy".into()) -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "" -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "xyzzy" -src/methods.rs:16: replace Foo::double with () -src/methods.rs:22: replace ::fmt -> fmt::Result with Ok(Default::default()) -src/methods.rs:28: replace ::fmt -> fmt::Result with Ok(Default::default()) -src/nested_function.rs:1: replace has_nested -> u32 with 0 -src/nested_function.rs:1: replace has_nested -> u32 with 1 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 0 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 1 -src/numbers.rs:1: replace double_float -> f32 with 0.0 -src/numbers.rs:1: replace double_float -> f32 with 1.0 -src/numbers.rs:1: replace double_float -> f32 with -1.0 -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("") -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") -src/result.rs:9: replace error_if_negative -> Result<(), ()> with Ok(()) -src/result.rs:17: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::new() -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) -src/simple_fns.rs:7: replace returns_unit with () -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 0 -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 1 -src/simple_fns.rs:17: replace divisible_by_three -> bool with true -src/simple_fns.rs:17: replace divisible_by_three -> bool with false -src/simple_fns.rs:26: replace double_string -> String with String::new() -src/simple_fns.rs:26: replace double_string -> String with "xyzzy".into() -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 0 -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 1 +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new(String::new()) +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new("xyzzy".into()) +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "" +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "xyzzy" +src/methods.rs:17:9: replace Foo::double with () +src/methods.rs:23:9: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/methods.rs:29:9: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/nested_function.rs:2:5: replace has_nested -> u32 with 0 +src/nested_function.rs:2:5: replace has_nested -> u32 with 1 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 +src/numbers.rs:2:5: replace double_float -> f32 with 0.0 +src/numbers.rs:2:5: replace double_float -> f32 with 1.0 +src/numbers.rs:2:5: replace double_float -> f32 with -1.0 +src/numbers.rs:6:5: replace is_double -> bool with true +src/numbers.rs:6:5: replace is_double -> bool with false +src/numbers.rs:6:7: replace == with != in is_double +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("") +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") +src/result.rs:10:5: replace error_if_negative -> Result<(), ()> with Ok(()) +src/result.rs:18:5: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::new() +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) +src/simple_fns.rs:8:5: replace returns_unit with () +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 0 +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 1 +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with true +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with false +src/simple_fns.rs:18:11: replace == with != in divisible_by_three +src/simple_fns.rs:27:5: replace double_string -> String with String::new() +src/simple_fns.rs:27:5: replace double_string -> String with "xyzzy".into() +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) +src/static_item.rs:1:33: replace == with != in module +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 0 +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 1 ``` ## testdata/with_child_directories ``` -src/methods.rs:1: replace double -> usize with 0 -src/methods.rs:1: replace double -> usize with 1 -src/module/module_methods.rs:1: replace double -> usize with 0 -src/module/module_methods.rs:1: replace double -> usize with 1 -src/module/utils/inside_mod.rs:3: replace outer::inner::name -> &'static str with "" -src/module/utils/inside_mod.rs:3: replace outer::inner::name -> &'static str with "xyzzy" -src/module/utils/nested_function.rs:1: replace has_nested -> u32 with 0 -src/module/utils/nested_function.rs:1: replace has_nested -> u32 with 1 -src/module/utils/nested_function.rs:2: replace has_nested::inner -> u32 with 0 -src/module/utils/nested_function.rs:2: replace has_nested::inner -> u32 with 1 -src/module/utils/sub_utils/subutils_nested_function.rs:1: replace has_nested -> u32 with 0 -src/module/utils/sub_utils/subutils_nested_function.rs:1: replace has_nested -> u32 with 1 -src/module/utils/sub_utils/subutils_nested_function.rs:2: replace has_nested::inner -> u32 with 0 -src/module/utils/sub_utils/subutils_nested_function.rs:2: replace has_nested::inner -> u32 with 1 +src/methods.rs:2:5: replace double -> usize with 0 +src/methods.rs:2:5: replace double -> usize with 1 +src/module/module_methods.rs:2:5: replace double -> usize with 0 +src/module/module_methods.rs:2:5: replace double -> usize with 1 +src/module/utils/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "" +src/module/utils/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "xyzzy" +src/module/utils/nested_function.rs:2:5: replace has_nested -> u32 with 0 +src/module/utils/nested_function.rs:2:5: replace has_nested -> u32 with 1 +src/module/utils/nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 +src/module/utils/nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 +src/module/utils/sub_utils/subutils_nested_function.rs:2:5: replace has_nested -> u32 with 0 +src/module/utils/sub_utils/subutils_nested_function.rs:2:5: replace has_nested -> u32 with 1 +src/module/utils/sub_utils/subutils_nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 +src/module/utils/sub_utils/subutils_nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 ``` ## testdata/workspace ``` -utils/src/lib.rs:1: replace triple -> i32 with 0 -utils/src/lib.rs:1: replace triple -> i32 with 1 -utils/src/lib.rs:1: replace triple -> i32 with -1 -main/src/main.rs:11: replace factorial -> u32 with 0 -main/src/main.rs:11: replace factorial -> u32 with 1 -main2/src/main.rs:9: replace triple_3 -> i32 with 0 -main2/src/main.rs:9: replace triple_3 -> i32 with 1 -main2/src/main.rs:9: replace triple_3 -> i32 with -1 +utils/src/lib.rs:2:5: replace triple -> i32 with 0 +utils/src/lib.rs:2:5: replace triple -> i32 with 1 +utils/src/lib.rs:2:5: replace triple -> i32 with -1 +main/src/main.rs:12:5: replace factorial -> u32 with 0 +main/src/main.rs:12:5: replace factorial -> u32 with 1 +main2/src/main.rs:10:5: replace triple_3 -> i32 with 0 +main2/src/main.rs:10:5: replace triple_3 -> i32 with 1 +main2/src/main.rs:10:5: replace triple_3 -> i32 with -1 ``` diff --git a/tests/cli/snapshots/cli__list_mutants_in_cfg_attr_test_skip.snap b/tests/cli/snapshots/cli__list_mutants_in_cfg_attr_test_skip.snap index faa8c6f3..6d042382 100644 --- a/tests/cli/snapshots/cli__list_mutants_in_cfg_attr_test_skip.snap +++ b/tests/cli/snapshots/cli__list_mutants_in_cfg_attr_test_skip.snap @@ -2,6 +2,6 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/lib.rs:17: replace double -> usize with 0 -src/lib.rs:17: replace double -> usize with 1 +src/lib.rs:18:5: replace double -> usize with 0 +src/lib.rs:18:5: replace double -> usize with 1 diff --git a/tests/cli/snapshots/cli__list_mutants_in_cfg_attr_test_skip_json.snap b/tests/cli/snapshots/cli__list_mutants_in_cfg_attr_test_skip_json.snap index cef3a05e..b8ebc631 100644 --- a/tests/cli/snapshots/cli__list_mutants_in_cfg_attr_test_skip_json.snap +++ b/tests/cli/snapshots/cli__list_mutants_in_cfg_attr_test_skip_json.snap @@ -5,20 +5,62 @@ expression: "String::from_utf8_lossy(&output.stdout)" [ { "file": "src/lib.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-cfg-attr-test-skip", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } }, { "file": "src/lib.rs", - "function": "double", + "function": { + "function_name": "double", + "return_type": "-> usize", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-cfg-attr-test-skip", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 10, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } } ] diff --git a/tests/cli/snapshots/cli__list_mutants_in_factorial.snap b/tests/cli/snapshots/cli__list_mutants_in_factorial.snap index ce905f82..87e22a11 100644 --- a/tests/cli/snapshots/cli__list_mutants_in_factorial.snap +++ b/tests/cli/snapshots/cli__list_mutants_in_factorial.snap @@ -2,7 +2,7 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/bin/factorial.rs:1: replace main with () -src/bin/factorial.rs:7: replace factorial -> u32 with 0 -src/bin/factorial.rs:7: replace factorial -> u32 with 1 +src/bin/factorial.rs:2:5: replace main with () +src/bin/factorial.rs:8:5: replace factorial -> u32 with 0 +src/bin/factorial.rs:8:5: replace factorial -> u32 with 1 diff --git a/tests/cli/snapshots/cli__list_mutants_in_factorial_json.snap b/tests/cli/snapshots/cli__list_mutants_in_factorial_json.snap index 302795c7..593a4d9f 100644 --- a/tests/cli/snapshots/cli__list_mutants_in_factorial_json.snap +++ b/tests/cli/snapshots/cli__list_mutants_in_factorial_json.snap @@ -5,29 +5,92 @@ expression: "String::from_utf8_lossy(&output.stdout)" [ { "file": "src/bin/factorial.rs", - "function": "main", + "function": { + "function_name": "main", + "return_type": "", + "span": { + "end": { + "column": 2, + "line": 5 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-factorial", "replacement": "()", - "return_type": "" + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/bin/factorial.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 13 + }, + "start": { + "column": 1, + "line": 7 + } + } + }, "genre": "FnValue", - "line": 7, "package": "cargo-mutants-testdata-factorial", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 12 + }, + "start": { + "column": 5, + "line": 8 + } + } }, { "file": "src/bin/factorial.rs", - "function": "factorial", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 13 + }, + "start": { + "column": 1, + "line": 7 + } + } + }, "genre": "FnValue", - "line": 7, "package": "cargo-mutants-testdata-factorial", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 6, + "line": 12 + }, + "start": { + "column": 5, + "line": 8 + } + } } ] diff --git a/tests/cli/snapshots/cli__list_mutants_json_well_tested.snap b/tests/cli/snapshots/cli__list_mutants_json_well_tested.snap index 1fac9ab0..756728f7 100644 --- a/tests/cli/snapshots/cli__list_mutants_json_well_tested.snap +++ b/tests/cli/snapshots/cli__list_mutants_json_well_tested.snap @@ -5,344 +5,1279 @@ expression: "String::from_utf8_lossy(&output.stdout)" [ { "file": "src/arc.rs", - "function": "return_arc", + "function": { + "function_name": "return_arc", + "return_type": "-> Arc", + "span": { + "end": { + "column": 2, + "line": 5 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Arc::new(String::new())", - "return_type": "-> Arc" + "span": { + "end": { + "column": 37, + "line": 4 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/arc.rs", - "function": "return_arc", + "function": { + "function_name": "return_arc", + "return_type": "-> Arc", + "span": { + "end": { + "column": 2, + "line": 5 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Arc::new(\"xyzzy\".into())", - "return_type": "-> Arc" + "span": { + "end": { + "column": 37, + "line": 4 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/inside_mod.rs", - "function": "outer::inner::name", + "function": { + "function_name": "outer::inner::name", + "return_type": "-> &'static str", + "span": { + "end": { + "column": 10, + "line": 5 + }, + "start": { + "column": 9, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "\"\"", - "return_type": "-> &'static str" + "span": { + "end": { + "column": 18, + "line": 4 + }, + "start": { + "column": 13, + "line": 4 + } + } }, { "file": "src/inside_mod.rs", - "function": "outer::inner::name", + "function": { + "function_name": "outer::inner::name", + "return_type": "-> &'static str", + "span": { + "end": { + "column": 10, + "line": 5 + }, + "start": { + "column": 9, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "\"xyzzy\"", - "return_type": "-> &'static str" + "span": { + "end": { + "column": 18, + "line": 4 + }, + "start": { + "column": 13, + "line": 4 + } + } }, { "file": "src/methods.rs", - "function": "Foo::double", + "function": { + "function_name": "Foo::double", + "return_type": "", + "span": { + "end": { + "column": 6, + "line": 18 + }, + "start": { + "column": 5, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 16, "package": "cargo-mutants-testdata-well-tested", "replacement": "()", - "return_type": "" + "span": { + "end": { + "column": 21, + "line": 17 + }, + "start": { + "column": 9, + "line": 17 + } + } }, { "file": "src/methods.rs", - "function": "::fmt", + "function": { + "function_name": "::fmt", + "return_type": "-> fmt::Result", + "span": { + "end": { + "column": 6, + "line": 24 + }, + "start": { + "column": 5, + "line": 22 + } + } + }, "genre": "FnValue", - "line": 22, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(Default::default())", - "return_type": "-> fmt::Result" + "span": { + "end": { + "column": 36, + "line": 23 + }, + "start": { + "column": 9, + "line": 23 + } + } }, { "file": "src/methods.rs", - "function": "::fmt", + "function": { + "function_name": "::fmt", + "return_type": "-> fmt::Result", + "span": { + "end": { + "column": 6, + "line": 30 + }, + "start": { + "column": 5, + "line": 28 + } + } + }, "genre": "FnValue", - "line": 28, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(Default::default())", - "return_type": "-> fmt::Result" + "span": { + "end": { + "column": 37, + "line": 29 + }, + "start": { + "column": 9, + "line": 29 + } + } }, { "file": "src/nested_function.rs", - "function": "has_nested", + "function": { + "function_name": "has_nested", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 6 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 22, + "line": 5 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/nested_function.rs", - "function": "has_nested", + "function": { + "function_name": "has_nested", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 6 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 22, + "line": 5 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/nested_function.rs", - "function": "has_nested::inner", + "function": { + "function_name": "has_nested::inner", + "return_type": "-> u32", + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "cargo-mutants-testdata-well-tested", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 11, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + } }, { "file": "src/nested_function.rs", - "function": "has_nested::inner", + "function": { + "function_name": "has_nested::inner", + "return_type": "-> u32", + "span": { + "end": { + "column": 6, + "line": 4 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, "genre": "FnValue", - "line": 2, "package": "cargo-mutants-testdata-well-tested", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 11, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + } }, { "file": "src/numbers.rs", - "function": "double_float", + "function": { + "function_name": "double_float", + "return_type": "-> f32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "0.0", - "return_type": "-> f32" + "span": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/numbers.rs", - "function": "double_float", + "function": { + "function_name": "double_float", + "return_type": "-> f32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "1.0", - "return_type": "-> f32" + "span": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } }, { "file": "src/numbers.rs", - "function": "double_float", + "function": { + "function_name": "double_float", + "return_type": "-> f32", + "span": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + } + }, "genre": "FnValue", - "line": 1, "package": "cargo-mutants-testdata-well-tested", "replacement": "-1.0", - "return_type": "-> f32" + "span": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + } + }, + { + "file": "src/numbers.rs", + "function": { + "function_name": "is_double", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, + "genre": "FnValue", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "true", + "span": { + "end": { + "column": 15, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } + }, + { + "file": "src/numbers.rs", + "function": { + "function_name": "is_double", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, + "genre": "FnValue", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "false", + "span": { + "end": { + "column": 15, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } + }, + { + "file": "src/numbers.rs", + "function": { + "function_name": "is_double", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 5 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "!=", + "span": { + "end": { + "column": 9, + "line": 6 + }, + "start": { + "column": 7, + "line": 6 + } + } }, { "file": "src/result.rs", - "function": "simple_result", + "function": { + "function_name": "simple_result", + "return_type": "-> Result<&'static str, ()>", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 4 + } + } + }, "genre": "FnValue", - "line": 5, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(\"\")", - "return_type": "-> Result<&'static str, ()>" + "span": { + "end": { + "column": 18, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } }, { "file": "src/result.rs", - "function": "simple_result", + "function": { + "function_name": "simple_result", + "return_type": "-> Result<&'static str, ()>", + "span": { + "end": { + "column": 2, + "line": 7 + }, + "start": { + "column": 1, + "line": 4 + } + } + }, "genre": "FnValue", - "line": 5, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(\"xyzzy\")", - "return_type": "-> Result<&'static str, ()>" + "span": { + "end": { + "column": 18, + "line": 6 + }, + "start": { + "column": 5, + "line": 6 + } + } }, { "file": "src/result.rs", - "function": "error_if_negative", + "function": { + "function_name": "error_if_negative", + "return_type": "-> Result<(), ()>", + "span": { + "end": { + "column": 2, + "line": 15 + }, + "start": { + "column": 1, + "line": 9 + } + } + }, "genre": "FnValue", - "line": 9, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(())", - "return_type": "-> Result<(), ()>" + "span": { + "end": { + "column": 6, + "line": 14 + }, + "start": { + "column": 5, + "line": 10 + } + } }, { "file": "src/result.rs", - "function": "result_with_no_apparent_type_args", + "function": { + "function_name": "result_with_no_apparent_type_args", + "return_type": "-> std::fmt::Result", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 17 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-well-tested", "replacement": "Ok(Default::default())", - "return_type": "-> std::fmt::Result" + "span": { + "end": { + "column": 28, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } }, { "file": "src/sets.rs", - "function": "make_a_set", + "function": { + "function_name": "make_a_set", + "return_type": "-> BTreeSet", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "BTreeSet::new()", - "return_type": "-> BTreeSet" + "span": { + "end": { + "column": 6, + "line": 7 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/sets.rs", - "function": "make_a_set", + "function": { + "function_name": "make_a_set", + "return_type": "-> BTreeSet", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "BTreeSet::from_iter([String::new()])", - "return_type": "-> BTreeSet" + "span": { + "end": { + "column": 6, + "line": 7 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/sets.rs", - "function": "make_a_set", + "function": { + "function_name": "make_a_set", + "return_type": "-> BTreeSet", + "span": { + "end": { + "column": 2, + "line": 8 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "BTreeSet::from_iter([\"xyzzy\".into()])", - "return_type": "-> BTreeSet" + "span": { + "end": { + "column": 6, + "line": 7 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/simple_fns.rs", - "function": "returns_unit", + "function": { + "function_name": "returns_unit", + "return_type": "", + "span": { + "end": { + "column": 2, + "line": 9 + }, + "start": { + "column": 1, + "line": 7 + } + } + }, "genre": "FnValue", - "line": 7, "package": "cargo-mutants-testdata-well-tested", "replacement": "()", - "return_type": "" + "span": { + "end": { + "column": 13, + "line": 8 + }, + "start": { + "column": 5, + "line": 8 + } + } }, { "file": "src/simple_fns.rs", - "function": "returns_42u32", + "function": { + "function_name": "returns_42u32", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 14 + }, + "start": { + "column": 1, + "line": 11 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "0", - "return_type": "-> u32" + "span": { + "end": { + "column": 7, + "line": 13 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/simple_fns.rs", - "function": "returns_42u32", + "function": { + "function_name": "returns_42u32", + "return_type": "-> u32", + "span": { + "end": { + "column": 2, + "line": 14 + }, + "start": { + "column": 1, + "line": 11 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "1", - "return_type": "-> u32" + "span": { + "end": { + "column": 7, + "line": 13 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/simple_fns.rs", - "function": "divisible_by_three", + "function": { + "function_name": "divisible_by_three", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-well-tested", "replacement": "true", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } }, { "file": "src/simple_fns.rs", - "function": "divisible_by_three", + "function": { + "function_name": "divisible_by_three", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-well-tested", "replacement": "false", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } }, { "file": "src/simple_fns.rs", - "function": "double_string", + "function": { + "function_name": "divisible_by_three", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "!=", + "span": { + "end": { + "column": 13, + "line": 18 + }, + "start": { + "column": 11, + "line": 18 + } + } + }, + { + "file": "src/simple_fns.rs", + "function": { + "function_name": "double_string", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 30 + }, + "start": { + "column": 1, + "line": 21 + } + } + }, "genre": "FnValue", - "line": 26, "package": "cargo-mutants-testdata-well-tested", "replacement": "String::new()", - "return_type": "-> String" + "span": { + "end": { + "column": 6, + "line": 29 + }, + "start": { + "column": 5, + "line": 27 + } + } }, { "file": "src/simple_fns.rs", - "function": "double_string", + "function": { + "function_name": "double_string", + "return_type": "-> String", + "span": { + "end": { + "column": 2, + "line": 30 + }, + "start": { + "column": 1, + "line": 21 + } + } + }, "genre": "FnValue", - "line": 26, "package": "cargo-mutants-testdata-well-tested", "replacement": "\"xyzzy\".into()", - "return_type": "-> String" + "span": { + "end": { + "column": 6, + "line": 29 + }, + "start": { + "column": 5, + "line": 27 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(Vec::new())", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![Cow::Borrowed(\"\")])", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![Cow::Owned(\"\".to_owned())])", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![Cow::Borrowed(\"xyzzy\")])", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "pad", + "function": { + "function_name": "pad", + "return_type": "-> &'a[Cow<'static, str>]", + "span": { + "end": { + "column": 2, + "line": 10 + }, + "start": { + "column": 1, + "line": 3 + } + } + }, "genre": "FnValue", - "line": 3, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![Cow::Owned(\"xyzzy\".to_owned())])", - "return_type": "-> &'a[Cow<'static, str>]" + "span": { + "end": { + "column": 7, + "line": 9 + }, + "start": { + "column": 5, + "line": 4 + } + } }, { "file": "src/slices.rs", - "function": "return_mut_slice", + "function": { + "function_name": "return_mut_slice", + "return_type": "-> &mut[usize]", + "span": { + "end": { + "column": 2, + "line": 17 + }, + "start": { + "column": 1, + "line": 12 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(Vec::new())", - "return_type": "-> &mut[usize]" + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/slices.rs", - "function": "return_mut_slice", + "function": { + "function_name": "return_mut_slice", + "return_type": "-> &mut[usize]", + "span": { + "end": { + "column": 2, + "line": 17 + }, + "start": { + "column": 1, + "line": 12 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![0])", - "return_type": "-> &mut[usize]" + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 13 + } + } }, { "file": "src/slices.rs", - "function": "return_mut_slice", + "function": { + "function_name": "return_mut_slice", + "return_type": "-> &mut[usize]", + "span": { + "end": { + "column": 2, + "line": 17 + }, + "start": { + "column": 1, + "line": 12 + } + } + }, "genre": "FnValue", - "line": 12, "package": "cargo-mutants-testdata-well-tested", "replacement": "Vec::leak(vec![1])", - "return_type": "-> &mut[usize]" + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 13 + } + } + }, + { + "file": "src/static_item.rs", + "function": null, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "!=", + "span": { + "end": { + "column": 35, + "line": 1 + }, + "start": { + "column": 33, + "line": 1 + } + } }, { "file": "src/struct_with_lifetime.rs", - "function": "Lex<'buf>::buf_len", + "function": { + "function_name": "Lex<'buf>::buf_len", + "return_type": "-> usize", + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 14 + } + } + }, "genre": "FnValue", - "line": 14, "package": "cargo-mutants-testdata-well-tested", "replacement": "0", - "return_type": "-> usize" + "span": { + "end": { + "column": 23, + "line": 15 + }, + "start": { + "column": 9, + "line": 15 + } + } }, { "file": "src/struct_with_lifetime.rs", - "function": "Lex<'buf>::buf_len", + "function": { + "function_name": "Lex<'buf>::buf_len", + "return_type": "-> usize", + "span": { + "end": { + "column": 6, + "line": 16 + }, + "start": { + "column": 5, + "line": 14 + } + } + }, "genre": "FnValue", - "line": 14, "package": "cargo-mutants-testdata-well-tested", "replacement": "1", - "return_type": "-> usize" + "span": { + "end": { + "column": 23, + "line": 15 + }, + "start": { + "column": 9, + "line": 15 + } + } } ] diff --git a/tests/cli/snapshots/cli__list_mutants_regex_filters.snap b/tests/cli/snapshots/cli__list_mutants_regex_filters.snap index 197d2d56..4b559bf6 100644 --- a/tests/cli/snapshots/cli__list_mutants_regex_filters.snap +++ b/tests/cli/snapshots/cli__list_mutants_regex_filters.snap @@ -1,7 +1,8 @@ --- -source: tests/cli.rs +source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/simple_fns.rs:17: replace divisible_by_three -> bool with true -src/simple_fns.rs:17: replace divisible_by_three -> bool with false +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with true +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with false +src/simple_fns.rs:18:11: replace == with != in divisible_by_three diff --git a/tests/cli/snapshots/cli__list_mutants_regex_filters_json.snap b/tests/cli/snapshots/cli__list_mutants_regex_filters_json.snap index 86bc1126..f907131b 100644 --- a/tests/cli/snapshots/cli__list_mutants_regex_filters_json.snap +++ b/tests/cli/snapshots/cli__list_mutants_regex_filters_json.snap @@ -5,11 +5,62 @@ expression: "String::from_utf8_lossy(&output.stdout)" [ { "file": "src/simple_fns.rs", - "function": "divisible_by_three", + "function": { + "function_name": "divisible_by_three", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, "genre": "FnValue", - "line": 17, "package": "cargo-mutants-testdata-well-tested", "replacement": "true", - "return_type": "-> bool" + "span": { + "end": { + "column": 15, + "line": 18 + }, + "start": { + "column": 5, + "line": 18 + } + } + }, + { + "file": "src/simple_fns.rs", + "function": { + "function_name": "divisible_by_three", + "return_type": "-> bool", + "span": { + "end": { + "column": 2, + "line": 19 + }, + "start": { + "column": 1, + "line": 16 + } + } + }, + "genre": "BinaryOperator", + "package": "cargo-mutants-testdata-well-tested", + "replacement": "!=", + "span": { + "end": { + "column": 13, + "line": 18 + }, + "start": { + "column": 11, + "line": 18 + } + } } ] diff --git a/tests/cli/snapshots/cli__list_mutants_well_tested.snap b/tests/cli/snapshots/cli__list_mutants_well_tested.snap index 699d7215..1ba6b749 100644 --- a/tests/cli/snapshots/cli__list_mutants_well_tested.snap +++ b/tests/cli/snapshots/cli__list_mutants_well_tested.snap @@ -2,42 +2,47 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/arc.rs:3: replace return_arc -> Arc with Arc::new(String::new()) -src/arc.rs:3: replace return_arc -> Arc with Arc::new("xyzzy".into()) -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "" -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "xyzzy" -src/methods.rs:16: replace Foo::double with () -src/methods.rs:22: replace ::fmt -> fmt::Result with Ok(Default::default()) -src/methods.rs:28: replace ::fmt -> fmt::Result with Ok(Default::default()) -src/nested_function.rs:1: replace has_nested -> u32 with 0 -src/nested_function.rs:1: replace has_nested -> u32 with 1 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 0 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 1 -src/numbers.rs:1: replace double_float -> f32 with 0.0 -src/numbers.rs:1: replace double_float -> f32 with 1.0 -src/numbers.rs:1: replace double_float -> f32 with -1.0 -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("") -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") -src/result.rs:9: replace error_if_negative -> Result<(), ()> with Ok(()) -src/result.rs:17: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::new() -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) -src/simple_fns.rs:7: replace returns_unit with () -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 0 -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 1 -src/simple_fns.rs:17: replace divisible_by_three -> bool with true -src/simple_fns.rs:17: replace divisible_by_three -> bool with false -src/simple_fns.rs:26: replace double_string -> String with String::new() -src/simple_fns.rs:26: replace double_string -> String with "xyzzy".into() -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 0 -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 1 +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new(String::new()) +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new("xyzzy".into()) +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "" +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "xyzzy" +src/methods.rs:17:9: replace Foo::double with () +src/methods.rs:23:9: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/methods.rs:29:9: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/nested_function.rs:2:5: replace has_nested -> u32 with 0 +src/nested_function.rs:2:5: replace has_nested -> u32 with 1 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 +src/numbers.rs:2:5: replace double_float -> f32 with 0.0 +src/numbers.rs:2:5: replace double_float -> f32 with 1.0 +src/numbers.rs:2:5: replace double_float -> f32 with -1.0 +src/numbers.rs:6:5: replace is_double -> bool with true +src/numbers.rs:6:5: replace is_double -> bool with false +src/numbers.rs:6:7: replace == with != in is_double +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("") +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") +src/result.rs:10:5: replace error_if_negative -> Result<(), ()> with Ok(()) +src/result.rs:18:5: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::new() +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) +src/simple_fns.rs:8:5: replace returns_unit with () +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 0 +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 1 +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with true +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with false +src/simple_fns.rs:18:11: replace == with != in divisible_by_three +src/simple_fns.rs:27:5: replace double_string -> String with String::new() +src/simple_fns.rs:27:5: replace double_string -> String with "xyzzy".into() +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) +src/static_item.rs:1:33: replace == with != in module +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 0 +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 1 diff --git a/tests/cli/snapshots/cli__list_mutants_well_tested_examine_and_exclude_name_filter_combined.snap b/tests/cli/snapshots/cli__list_mutants_well_tested_examine_and_exclude_name_filter_combined.snap index a8faf61f..b24667ef 100644 --- a/tests/cli/snapshots/cli__list_mutants_well_tested_examine_and_exclude_name_filter_combined.snap +++ b/tests/cli/snapshots/cli__list_mutants_well_tested_examine_and_exclude_name_filter_combined.snap @@ -2,10 +2,10 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/module/utils/inside_mod.rs:3: replace outer::inner::name -> &'static str with "" -src/module/utils/inside_mod.rs:3: replace outer::inner::name -> &'static str with "xyzzy" -src/module/utils/sub_utils/subutils_nested_function.rs:1: replace has_nested -> u32 with 0 -src/module/utils/sub_utils/subutils_nested_function.rs:1: replace has_nested -> u32 with 1 -src/module/utils/sub_utils/subutils_nested_function.rs:2: replace has_nested::inner -> u32 with 0 -src/module/utils/sub_utils/subutils_nested_function.rs:2: replace has_nested::inner -> u32 with 1 +src/module/utils/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "" +src/module/utils/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "xyzzy" +src/module/utils/sub_utils/subutils_nested_function.rs:2:5: replace has_nested -> u32 with 0 +src/module/utils/sub_utils/subutils_nested_function.rs:2:5: replace has_nested -> u32 with 1 +src/module/utils/sub_utils/subutils_nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 +src/module/utils/sub_utils/subutils_nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 diff --git a/tests/cli/snapshots/cli__list_mutants_well_tested_examine_name_filter.snap b/tests/cli/snapshots/cli__list_mutants_well_tested_examine_name_filter.snap index 8d595f3e..11f92044 100644 --- a/tests/cli/snapshots/cli__list_mutants_well_tested_examine_name_filter.snap +++ b/tests/cli/snapshots/cli__list_mutants_well_tested_examine_name_filter.snap @@ -2,8 +2,8 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/nested_function.rs:1: replace has_nested -> u32 with 0 -src/nested_function.rs:1: replace has_nested -> u32 with 1 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 0 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 1 +src/nested_function.rs:2:5: replace has_nested -> u32 with 0 +src/nested_function.rs:2:5: replace has_nested -> u32 with 1 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 diff --git a/tests/cli/snapshots/cli__list_mutants_well_tested_exclude_folder_filter.snap b/tests/cli/snapshots/cli__list_mutants_well_tested_exclude_folder_filter.snap index 72ade5c9..c79cddac 100644 --- a/tests/cli/snapshots/cli__list_mutants_well_tested_exclude_folder_filter.snap +++ b/tests/cli/snapshots/cli__list_mutants_well_tested_exclude_folder_filter.snap @@ -2,6 +2,6 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/methods.rs:1: replace double -> usize with 0 -src/methods.rs:1: replace double -> usize with 1 +src/methods.rs:2:5: replace double -> usize with 0 +src/methods.rs:2:5: replace double -> usize with 1 diff --git a/tests/cli/snapshots/cli__list_mutants_well_tested_exclude_name_filter.snap b/tests/cli/snapshots/cli__list_mutants_well_tested_exclude_name_filter.snap index 7f71fbb3..42bb65ec 100644 --- a/tests/cli/snapshots/cli__list_mutants_well_tested_exclude_name_filter.snap +++ b/tests/cli/snapshots/cli__list_mutants_well_tested_exclude_name_filter.snap @@ -2,35 +2,39 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/arc.rs:3: replace return_arc -> Arc with Arc::new(String::new()) -src/arc.rs:3: replace return_arc -> Arc with Arc::new("xyzzy".into()) -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "" -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "xyzzy" -src/methods.rs:16: replace Foo::double with () -src/methods.rs:22: replace ::fmt -> fmt::Result with Ok(Default::default()) -src/methods.rs:28: replace ::fmt -> fmt::Result with Ok(Default::default()) -src/nested_function.rs:1: replace has_nested -> u32 with 0 -src/nested_function.rs:1: replace has_nested -> u32 with 1 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 0 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 1 -src/numbers.rs:1: replace double_float -> f32 with 0.0 -src/numbers.rs:1: replace double_float -> f32 with 1.0 -src/numbers.rs:1: replace double_float -> f32 with -1.0 -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("") -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") -src/result.rs:9: replace error_if_negative -> Result<(), ()> with Ok(()) -src/result.rs:17: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::new() -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 0 -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 1 +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new(String::new()) +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new("xyzzy".into()) +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "" +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "xyzzy" +src/methods.rs:17:9: replace Foo::double with () +src/methods.rs:23:9: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/methods.rs:29:9: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/nested_function.rs:2:5: replace has_nested -> u32 with 0 +src/nested_function.rs:2:5: replace has_nested -> u32 with 1 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 +src/numbers.rs:2:5: replace double_float -> f32 with 0.0 +src/numbers.rs:2:5: replace double_float -> f32 with 1.0 +src/numbers.rs:2:5: replace double_float -> f32 with -1.0 +src/numbers.rs:6:5: replace is_double -> bool with true +src/numbers.rs:6:5: replace is_double -> bool with false +src/numbers.rs:6:7: replace == with != in is_double +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("") +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") +src/result.rs:10:5: replace error_if_negative -> Result<(), ()> with Ok(()) +src/result.rs:18:5: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::new() +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) +src/static_item.rs:1:33: replace == with != in module +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 0 +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 1 diff --git a/tests/cli/snapshots/cli__list_mutants_well_tested_multiple_examine_and_exclude_name_filter_with_files_and_folders.snap b/tests/cli/snapshots/cli__list_mutants_well_tested_multiple_examine_and_exclude_name_filter_with_files_and_folders.snap index 434152b7..0d175630 100644 --- a/tests/cli/snapshots/cli__list_mutants_well_tested_multiple_examine_and_exclude_name_filter_with_files_and_folders.snap +++ b/tests/cli/snapshots/cli__list_mutants_well_tested_multiple_examine_and_exclude_name_filter_with_files_and_folders.snap @@ -2,8 +2,8 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/module/module_methods.rs:1: replace double -> usize with 0 -src/module/module_methods.rs:1: replace double -> usize with 1 -src/module/utils/inside_mod.rs:3: replace outer::inner::name -> &'static str with "" -src/module/utils/inside_mod.rs:3: replace outer::inner::name -> &'static str with "xyzzy" +src/module/module_methods.rs:2:5: replace double -> usize with 0 +src/module/module_methods.rs:2:5: replace double -> usize with 1 +src/module/utils/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "" +src/module/utils/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "xyzzy" diff --git a/tests/cli/snapshots/cli__list_mutants_with_diffs_in_factorial.snap b/tests/cli/snapshots/cli__list_mutants_with_diffs_in_factorial.snap index 43d1f323..9c059f4a 100644 --- a/tests/cli/snapshots/cli__list_mutants_with_diffs_in_factorial.snap +++ b/tests/cli/snapshots/cli__list_mutants_with_diffs_in_factorial.snap @@ -2,7 +2,7 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/bin/factorial.rs:1: replace main with () +src/bin/factorial.rs:2:5: replace main with () --- src/bin/factorial.rs +++ replace main with () @@ -1,12 +1,10 @@ @@ -10,7 +10,7 @@ src/bin/factorial.rs:1: replace main with () - for i in 1..=6 { - println!("{}! = {}", i, factorial(i)); - } -+() /* ~ changed by cargo-mutants ~ */ ++ () /* ~ changed by cargo-mutants ~ */ } fn factorial(n: u32) -> u32 { @@ -20,7 +20,7 @@ src/bin/factorial.rs:1: replace main with () } a -src/bin/factorial.rs:7: replace factorial -> u32 with 0 +src/bin/factorial.rs:8:5: replace factorial -> u32 with 0 --- src/bin/factorial.rs +++ replace factorial -> u32 with 0 @@ -1,19 +1,15 @@ @@ -36,7 +36,7 @@ src/bin/factorial.rs:7: replace factorial -> u32 with 0 - a *= i; - } - a -+0 /* ~ changed by cargo-mutants ~ */ ++ 0 /* ~ changed by cargo-mutants ~ */ } #[test] @@ -45,7 +45,7 @@ src/bin/factorial.rs:7: replace factorial -> u32 with 0 assert_eq!(factorial(6), 720); } -src/bin/factorial.rs:7: replace factorial -> u32 with 1 +src/bin/factorial.rs:8:5: replace factorial -> u32 with 1 --- src/bin/factorial.rs +++ replace factorial -> u32 with 1 @@ -1,19 +1,15 @@ @@ -61,7 +61,7 @@ src/bin/factorial.rs:7: replace factorial -> u32 with 1 - a *= i; - } - a -+1 /* ~ changed by cargo-mutants ~ */ ++ 1 /* ~ changed by cargo-mutants ~ */ } #[test] diff --git a/tests/cli/snapshots/cli__list_mutants_with_dir_option.snap b/tests/cli/snapshots/cli__list_mutants_with_dir_option.snap index ce905f82..87e22a11 100644 --- a/tests/cli/snapshots/cli__list_mutants_with_dir_option.snap +++ b/tests/cli/snapshots/cli__list_mutants_with_dir_option.snap @@ -2,7 +2,7 @@ source: tests/cli/main.rs expression: "String::from_utf8_lossy(&output.stdout)" --- -src/bin/factorial.rs:1: replace main with () -src/bin/factorial.rs:7: replace factorial -> u32 with 0 -src/bin/factorial.rs:7: replace factorial -> u32 with 1 +src/bin/factorial.rs:2:5: replace main with () +src/bin/factorial.rs:8:5: replace factorial -> u32 with 0 +src/bin/factorial.rs:8:5: replace factorial -> u32 with 1 diff --git a/tests/cli/snapshots/cli__mutants.json.snap b/tests/cli/snapshots/cli__mutants.json.snap index 994592a0..9ea1afcc 100644 --- a/tests/cli/snapshots/cli__mutants.json.snap +++ b/tests/cli/snapshots/cli__mutants.json.snap @@ -6,27 +6,90 @@ expression: mutants_json { "package": "cargo-mutants-testdata-factorial", "file": "src/bin/factorial.rs", - "line": 1, - "function": "main", - "return_type": "", + "function": { + "function_name": "main", + "return_type": "", + "span": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + "span": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + }, "replacement": "()", "genre": "FnValue" }, { "package": "cargo-mutants-testdata-factorial", "file": "src/bin/factorial.rs", - "line": 7, - "function": "factorial", - "return_type": "-> u32", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "span": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + } + }, "replacement": "0", "genre": "FnValue" }, { "package": "cargo-mutants-testdata-factorial", "file": "src/bin/factorial.rs", - "line": 7, - "function": "factorial", - "return_type": "-> u32", + "function": { + "function_name": "factorial", + "return_type": "-> u32", + "span": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "span": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + } + }, "replacement": "1", "genre": "FnValue" } diff --git a/tests/cli/snapshots/cli__mutants_are_unapplied_after_testing_so_later_missed_mutants_are_found.snap b/tests/cli/snapshots/cli__mutants_are_unapplied_after_testing_so_later_missed_mutants_are_found.snap index 95d30382..66c4ae69 100644 --- a/tests/cli/snapshots/cli__mutants_are_unapplied_after_testing_so_later_missed_mutants_are_found.snap +++ b/tests/cli/snapshots/cli__mutants_are_unapplied_after_testing_so_later_missed_mutants_are_found.snap @@ -4,10 +4,10 @@ expression: stdout --- Found 9 mutants to test Unmutated baseline ... ok -src/a.rs:1: replace one -> i32 with 1 ... NOT CAUGHT -src/b.rs:1: replace one_untested -> i32 with 0 ... NOT CAUGHT -src/b.rs:1: replace one_untested -> i32 with 1 ... NOT CAUGHT -src/b.rs:1: replace one_untested -> i32 with -1 ... NOT CAUGHT -src/c.rs:1: replace one -> i32 with 1 ... NOT CAUGHT +src/a.rs:2:5: replace one -> i32 with 1 ... NOT CAUGHT +src/b.rs:2:5: replace one_untested -> i32 with 0 ... NOT CAUGHT +src/b.rs:2:5: replace one_untested -> i32 with 1 ... NOT CAUGHT +src/b.rs:2:5: replace one_untested -> i32 with -1 ... NOT CAUGHT +src/c.rs:2:5: replace one -> i32 with 1 ... NOT CAUGHT 9 mutants tested: 5 missed, 4 caught diff --git a/tests/cli/snapshots/cli__small_well_tested_tree_is_clean.snap b/tests/cli/snapshots/cli__small_well_tested_tree_is_clean.snap index cfecdaf0..a48a7398 100644 --- a/tests/cli/snapshots/cli__small_well_tested_tree_is_clean.snap +++ b/tests/cli/snapshots/cli__small_well_tested_tree_is_clean.snap @@ -4,7 +4,7 @@ expression: stdout --- Found 2 mutants to test Unmutated baseline ... ok -src/lib.rs:4: replace factorial -> u32 with 0 ... caught -src/lib.rs:4: replace factorial -> u32 with 1 ... caught +src/lib.rs:5:5: replace factorial -> u32 with 0 ... caught +src/lib.rs:5:5: replace factorial -> u32 with 1 ... caught 2 mutants tested: 2 caught diff --git a/tests/cli/snapshots/cli__uncaught_mutant_in_factorial.snap b/tests/cli/snapshots/cli__uncaught_mutant_in_factorial.snap index 319046ac..239c5e81 100644 --- a/tests/cli/snapshots/cli__uncaught_mutant_in_factorial.snap +++ b/tests/cli/snapshots/cli__uncaught_mutant_in_factorial.snap @@ -5,6 +5,6 @@ expression: redact_timestamps_sizes(stdout) Found 3 mutants to test Unmutated baseline ... ok in x.xxxs build + x.xxxs test Auto-set test timeout to x.xxxs -src/bin/factorial.rs:1: replace main with () ... NOT CAUGHT in x.xxxs build + x.xxxs test +src/bin/factorial.rs:2:5: replace main with () ... NOT CAUGHT in x.xxxs build + x.xxxs test 3 mutants tested in x.xxxs: 1 missed, 2 caught diff --git a/tests/cli/snapshots/cli__uncaught_mutant_in_factorial__caught.txt.snap b/tests/cli/snapshots/cli__uncaught_mutant_in_factorial__caught.txt.snap index 2c7ff0a7..8051ebf6 100644 --- a/tests/cli/snapshots/cli__uncaught_mutant_in_factorial__caught.txt.snap +++ b/tests/cli/snapshots/cli__uncaught_mutant_in_factorial__caught.txt.snap @@ -2,6 +2,6 @@ source: tests/cli/main.rs expression: content --- -src/bin/factorial.rs:7: replace factorial -> u32 with 0 -src/bin/factorial.rs:7: replace factorial -> u32 with 1 +src/bin/factorial.rs:8:5: replace factorial -> u32 with 0 +src/bin/factorial.rs:8:5: replace factorial -> u32 with 1 diff --git a/tests/cli/snapshots/cli__uncaught_mutant_in_factorial__missed.txt.snap b/tests/cli/snapshots/cli__uncaught_mutant_in_factorial__missed.txt.snap index 8587903e..f2a7984e 100644 --- a/tests/cli/snapshots/cli__uncaught_mutant_in_factorial__missed.txt.snap +++ b/tests/cli/snapshots/cli__uncaught_mutant_in_factorial__missed.txt.snap @@ -1,6 +1,6 @@ --- -source: tests/cli.rs -expression: missed_txt +source: tests/cli/main.rs +expression: content --- -src/bin/factorial.rs:1: replace main with () +src/bin/factorial.rs:2:5: replace main with () diff --git a/tests/cli/snapshots/cli__unviable_mutation_of_struct_with_no_default__unviable.txt.snap b/tests/cli/snapshots/cli__unviable_mutation_of_struct_with_no_default__unviable.txt.snap index 31f04158..bf5998a1 100644 --- a/tests/cli/snapshots/cli__unviable_mutation_of_struct_with_no_default__unviable.txt.snap +++ b/tests/cli/snapshots/cli__unviable_mutation_of_struct_with_no_default__unviable.txt.snap @@ -2,5 +2,5 @@ source: tests/cli/main.rs expression: content --- -src/lib.rs:11: replace make_an_s -> S with Default::default() +src/lib.rs:12:5: replace make_an_s -> S with Default::default() diff --git a/tests/cli/snapshots/cli__well_tested_tree_check_only.snap b/tests/cli/snapshots/cli__well_tested_tree_check_only.snap index 235ad9b9..396d9edc 100644 --- a/tests/cli/snapshots/cli__well_tested_tree_check_only.snap +++ b/tests/cli/snapshots/cli__well_tested_tree_check_only.snap @@ -2,45 +2,50 @@ source: tests/cli/main.rs expression: stdout --- -Found 38 mutants to test +Found 43 mutants to test Unmutated baseline ... ok -src/arc.rs:3: replace return_arc -> Arc with Arc::new(String::new()) ... ok -src/arc.rs:3: replace return_arc -> Arc with Arc::new("xyzzy".into()) ... ok -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "" ... ok -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "xyzzy" ... ok -src/methods.rs:16: replace Foo::double with () ... ok -src/methods.rs:22: replace ::fmt -> fmt::Result with Ok(Default::default()) ... ok -src/methods.rs:28: replace ::fmt -> fmt::Result with Ok(Default::default()) ... ok -src/nested_function.rs:1: replace has_nested -> u32 with 0 ... ok -src/nested_function.rs:1: replace has_nested -> u32 with 1 ... ok -src/nested_function.rs:2: replace has_nested::inner -> u32 with 0 ... ok -src/nested_function.rs:2: replace has_nested::inner -> u32 with 1 ... ok -src/numbers.rs:1: replace double_float -> f32 with 0.0 ... ok -src/numbers.rs:1: replace double_float -> f32 with 1.0 ... ok -src/numbers.rs:1: replace double_float -> f32 with -1.0 ... ok -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("") ... ok -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") ... ok -src/result.rs:9: replace error_if_negative -> Result<(), ()> with Ok(()) ... ok -src/result.rs:17: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) ... ok -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::new() ... ok -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) ... ok -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) ... ok -src/simple_fns.rs:7: replace returns_unit with () ... ok -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 0 ... ok -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 1 ... ok -src/simple_fns.rs:17: replace divisible_by_three -> bool with true ... ok -src/simple_fns.rs:17: replace divisible_by_three -> bool with false ... ok -src/simple_fns.rs:26: replace double_string -> String with String::new() ... ok -src/simple_fns.rs:26: replace double_string -> String with "xyzzy".into() ... ok -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) ... ok -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) ... ok -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) ... ok -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) ... ok -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) ... ok -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) ... ok -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) ... ok -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) ... ok -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 0 ... ok -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 1 ... ok -38 mutants tested: 38 succeeded +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new(String::new()) ... ok +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new("xyzzy".into()) ... ok +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "" ... ok +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "xyzzy" ... ok +src/methods.rs:17:9: replace Foo::double with () ... ok +src/methods.rs:23:9: replace ::fmt -> fmt::Result with Ok(Default::default()) ... ok +src/methods.rs:29:9: replace ::fmt -> fmt::Result with Ok(Default::default()) ... ok +src/nested_function.rs:2:5: replace has_nested -> u32 with 0 ... ok +src/nested_function.rs:2:5: replace has_nested -> u32 with 1 ... ok +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 ... ok +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 ... ok +src/numbers.rs:2:5: replace double_float -> f32 with 0.0 ... ok +src/numbers.rs:2:5: replace double_float -> f32 with 1.0 ... ok +src/numbers.rs:2:5: replace double_float -> f32 with -1.0 ... ok +src/numbers.rs:6:5: replace is_double -> bool with true ... ok +src/numbers.rs:6:5: replace is_double -> bool with false ... ok +src/numbers.rs:6:7: replace == with != in is_double ... ok +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("") ... ok +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") ... ok +src/result.rs:10:5: replace error_if_negative -> Result<(), ()> with Ok(()) ... ok +src/result.rs:18:5: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) ... ok +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::new() ... ok +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) ... ok +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) ... ok +src/simple_fns.rs:8:5: replace returns_unit with () ... ok +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 0 ... ok +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 1 ... ok +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with true ... ok +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with false ... ok +src/simple_fns.rs:18:11: replace == with != in divisible_by_three ... ok +src/simple_fns.rs:27:5: replace double_string -> String with String::new() ... ok +src/simple_fns.rs:27:5: replace double_string -> String with "xyzzy".into() ... ok +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) ... ok +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) ... ok +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) ... ok +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) ... ok +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) ... ok +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) ... ok +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) ... ok +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) ... ok +src/static_item.rs:1:33: replace == with != in module ... ok +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 0 ... ok +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 1 ... ok +43 mutants tested: 43 succeeded diff --git a/tests/cli/snapshots/cli__well_tested_tree_finds_no_problems.snap b/tests/cli/snapshots/cli__well_tested_tree_finds_no_problems.snap index 9ea15639..378a58eb 100644 --- a/tests/cli/snapshots/cli__well_tested_tree_finds_no_problems.snap +++ b/tests/cli/snapshots/cli__well_tested_tree_finds_no_problems.snap @@ -2,45 +2,50 @@ source: tests/cli/main.rs expression: stdout --- -Found 38 mutants to test +Found 43 mutants to test Unmutated baseline ... ok -src/arc.rs:3: replace return_arc -> Arc with Arc::new(String::new()) ... caught -src/arc.rs:3: replace return_arc -> Arc with Arc::new("xyzzy".into()) ... caught -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "" ... caught -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "xyzzy" ... caught -src/methods.rs:16: replace Foo::double with () ... caught -src/methods.rs:22: replace ::fmt -> fmt::Result with Ok(Default::default()) ... caught -src/methods.rs:28: replace ::fmt -> fmt::Result with Ok(Default::default()) ... caught -src/nested_function.rs:1: replace has_nested -> u32 with 0 ... caught -src/nested_function.rs:1: replace has_nested -> u32 with 1 ... caught -src/nested_function.rs:2: replace has_nested::inner -> u32 with 0 ... caught -src/nested_function.rs:2: replace has_nested::inner -> u32 with 1 ... caught -src/numbers.rs:1: replace double_float -> f32 with 0.0 ... caught -src/numbers.rs:1: replace double_float -> f32 with 1.0 ... caught -src/numbers.rs:1: replace double_float -> f32 with -1.0 ... caught -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("") ... caught -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") ... caught -src/result.rs:9: replace error_if_negative -> Result<(), ()> with Ok(()) ... caught -src/result.rs:17: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) ... caught -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::new() ... caught -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) ... caught -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) ... caught -src/simple_fns.rs:7: replace returns_unit with () ... caught -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 0 ... caught -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 1 ... caught -src/simple_fns.rs:17: replace divisible_by_three -> bool with true ... caught -src/simple_fns.rs:17: replace divisible_by_three -> bool with false ... caught -src/simple_fns.rs:26: replace double_string -> String with String::new() ... caught -src/simple_fns.rs:26: replace double_string -> String with "xyzzy".into() ... caught -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) ... caught -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) ... caught -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) ... caught -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) ... caught -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) ... caught -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) ... caught -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) ... caught -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) ... caught -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 0 ... caught -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 1 ... caught -38 mutants tested: 38 caught +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new(String::new()) ... caught +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new("xyzzy".into()) ... caught +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "" ... caught +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "xyzzy" ... caught +src/methods.rs:17:9: replace Foo::double with () ... caught +src/methods.rs:23:9: replace ::fmt -> fmt::Result with Ok(Default::default()) ... caught +src/methods.rs:29:9: replace ::fmt -> fmt::Result with Ok(Default::default()) ... caught +src/nested_function.rs:2:5: replace has_nested -> u32 with 0 ... caught +src/nested_function.rs:2:5: replace has_nested -> u32 with 1 ... caught +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 ... caught +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 ... caught +src/numbers.rs:2:5: replace double_float -> f32 with 0.0 ... caught +src/numbers.rs:2:5: replace double_float -> f32 with 1.0 ... caught +src/numbers.rs:2:5: replace double_float -> f32 with -1.0 ... caught +src/numbers.rs:6:5: replace is_double -> bool with true ... caught +src/numbers.rs:6:5: replace is_double -> bool with false ... caught +src/numbers.rs:6:7: replace == with != in is_double ... caught +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("") ... caught +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") ... caught +src/result.rs:10:5: replace error_if_negative -> Result<(), ()> with Ok(()) ... caught +src/result.rs:18:5: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) ... caught +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::new() ... caught +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) ... caught +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) ... caught +src/simple_fns.rs:8:5: replace returns_unit with () ... caught +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 0 ... caught +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 1 ... caught +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with true ... caught +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with false ... caught +src/simple_fns.rs:18:11: replace == with != in divisible_by_three ... caught +src/simple_fns.rs:27:5: replace double_string -> String with String::new() ... caught +src/simple_fns.rs:27:5: replace double_string -> String with "xyzzy".into() ... caught +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) ... caught +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) ... caught +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) ... caught +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) ... caught +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) ... caught +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) ... caught +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) ... caught +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) ... caught +src/static_item.rs:1:33: replace == with != in module ... caught +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 0 ... caught +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 1 ... caught +43 mutants tested: 43 caught diff --git a/tests/cli/snapshots/cli__well_tested_tree_finds_no_problems__caught.txt.snap b/tests/cli/snapshots/cli__well_tested_tree_finds_no_problems__caught.txt.snap index dfd3b2e4..e5bbcbd0 100644 --- a/tests/cli/snapshots/cli__well_tested_tree_finds_no_problems__caught.txt.snap +++ b/tests/cli/snapshots/cli__well_tested_tree_finds_no_problems__caught.txt.snap @@ -2,42 +2,47 @@ source: tests/cli/main.rs expression: content --- -src/arc.rs:3: replace return_arc -> Arc with Arc::new(String::new()) -src/arc.rs:3: replace return_arc -> Arc with Arc::new("xyzzy".into()) -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "" -src/inside_mod.rs:3: replace outer::inner::name -> &'static str with "xyzzy" -src/methods.rs:16: replace Foo::double with () -src/methods.rs:22: replace ::fmt -> fmt::Result with Ok(Default::default()) -src/methods.rs:28: replace ::fmt -> fmt::Result with Ok(Default::default()) -src/nested_function.rs:1: replace has_nested -> u32 with 0 -src/nested_function.rs:1: replace has_nested -> u32 with 1 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 0 -src/nested_function.rs:2: replace has_nested::inner -> u32 with 1 -src/numbers.rs:1: replace double_float -> f32 with 0.0 -src/numbers.rs:1: replace double_float -> f32 with 1.0 -src/numbers.rs:1: replace double_float -> f32 with -1.0 -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("") -src/result.rs:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") -src/result.rs:9: replace error_if_negative -> Result<(), ()> with Ok(()) -src/result.rs:17: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::new() -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) -src/sets.rs:3: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) -src/simple_fns.rs:7: replace returns_unit with () -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 0 -src/simple_fns.rs:12: replace returns_42u32 -> u32 with 1 -src/simple_fns.rs:17: replace divisible_by_three -> bool with true -src/simple_fns.rs:17: replace divisible_by_three -> bool with false -src/simple_fns.rs:26: replace double_string -> String with String::new() -src/simple_fns.rs:26: replace double_string -> String with "xyzzy".into() -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) -src/slices.rs:3: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) -src/slices.rs:12: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 0 -src/struct_with_lifetime.rs:14: replace Lex<'buf>::buf_len -> usize with 1 +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new(String::new()) +src/arc.rs:4:5: replace return_arc -> Arc with Arc::new("xyzzy".into()) +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "" +src/inside_mod.rs:4:13: replace outer::inner::name -> &'static str with "xyzzy" +src/methods.rs:17:9: replace Foo::double with () +src/methods.rs:23:9: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/methods.rs:29:9: replace ::fmt -> fmt::Result with Ok(Default::default()) +src/nested_function.rs:2:5: replace has_nested -> u32 with 0 +src/nested_function.rs:2:5: replace has_nested -> u32 with 1 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 0 +src/nested_function.rs:3:9: replace has_nested::inner -> u32 with 1 +src/numbers.rs:2:5: replace double_float -> f32 with 0.0 +src/numbers.rs:2:5: replace double_float -> f32 with 1.0 +src/numbers.rs:2:5: replace double_float -> f32 with -1.0 +src/numbers.rs:6:5: replace is_double -> bool with true +src/numbers.rs:6:5: replace is_double -> bool with false +src/numbers.rs:6:7: replace == with != in is_double +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("") +src/result.rs:6:5: replace simple_result -> Result<&'static str, ()> with Ok("xyzzy") +src/result.rs:10:5: replace error_if_negative -> Result<(), ()> with Ok(()) +src/result.rs:18:5: replace result_with_no_apparent_type_args -> std::fmt::Result with Ok(Default::default()) +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::new() +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter([String::new()]) +src/sets.rs:4:5: replace make_a_set -> BTreeSet with BTreeSet::from_iter(["xyzzy".into()]) +src/simple_fns.rs:8:5: replace returns_unit with () +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 0 +src/simple_fns.rs:13:5: replace returns_42u32 -> u32 with 1 +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with true +src/simple_fns.rs:18:5: replace divisible_by_three -> bool with false +src/simple_fns.rs:18:11: replace == with != in divisible_by_three +src/simple_fns.rs:27:5: replace double_string -> String with String::new() +src/simple_fns.rs:27:5: replace double_string -> String with "xyzzy".into() +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(Vec::new()) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("")]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("".to_owned())]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Borrowed("xyzzy")]) +src/slices.rs:4:5: replace pad -> &'a[Cow<'static, str>] with Vec::leak(vec![Cow::Owned("xyzzy".to_owned())]) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(Vec::new()) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![0]) +src/slices.rs:13:5: replace return_mut_slice -> &mut[usize] with Vec::leak(vec![1]) +src/static_item.rs:1:33: replace == with != in module +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 0 +src/struct_with_lifetime.rs:15:9: replace Lex<'buf>::buf_len -> usize with 1 diff --git a/tests/cli/snapshots/cli__well_tested_tree_quiet.snap b/tests/cli/snapshots/cli__well_tested_tree_quiet.snap index b425f202..ee0e4373 100644 --- a/tests/cli/snapshots/cli__well_tested_tree_quiet.snap +++ b/tests/cli/snapshots/cli__well_tested_tree_quiet.snap @@ -2,7 +2,7 @@ source: tests/cli/main.rs expression: stdout --- -Found 38 mutants to test +Found 43 mutants to test Unmutated baseline ... ok -38 mutants tested: 38 caught +43 mutants tested: 43 caught diff --git a/tests/cli/workspace.rs b/tests/cli/workspace.rs index 4f73c278..95b5e98a 100644 --- a/tests/cli/workspace.rs +++ b/tests/cli/workspace.rs @@ -16,15 +16,16 @@ fn open_by_manifest_path() { .args([ "mutants", "--list", + "--line-col=false", "--manifest-path", "testdata/factorial/Cargo.toml", ]) .assert() .success() .stdout(indoc! {" - src/bin/factorial.rs:1: replace main with () - src/bin/factorial.rs:7: replace factorial -> u32 with 0 - src/bin/factorial.rs:7: replace factorial -> u32 with 1 + src/bin/factorial.rs: replace main with () + src/bin/factorial.rs: replace factorial -> u32 with 0 + src/bin/factorial.rs: replace factorial -> u32 with 1 "}); } @@ -202,8 +203,8 @@ fn in_workspace_only_relevant_packages_included_in_baseline_tests_by_file_filter assert_eq!( read_to_string(tmp.path().join("mutants.out/caught.txt")).unwrap(), indoc! { "\ - passing/src/lib.rs:1: replace triple -> usize with 0 - passing/src/lib.rs:1: replace triple -> usize with 1 + passing/src/lib.rs:2:5: replace triple -> usize with 0 + passing/src/lib.rs:2:5: replace triple -> usize with 1 "} ); assert_eq!( @@ -239,8 +240,8 @@ fn baseline_test_respects_package_options() { assert_eq!( read_to_string(tmp.path().join("mutants.out/caught.txt")).unwrap(), indoc! { "\ - passing/src/lib.rs:1: replace triple -> usize with 0 - passing/src/lib.rs:1: replace triple -> usize with 1 + passing/src/lib.rs:2:5: replace triple -> usize with 0 + passing/src/lib.rs:2:5: replace triple -> usize with 1 "} ); assert_eq!(