diff --git a/cargo-insta/tests/functional/inline.rs b/cargo-insta/tests/functional/inline.rs index edb9153e..2b8a3f0e 100644 --- a/cargo-insta/tests/functional/inline.rs +++ b/cargo-insta/tests/functional/inline.rs @@ -187,7 +187,7 @@ fn test_trailing_comma_in_inline_snapshot() { assert!(&output.status.success()); - assert_snapshot!(test_project.diff("src/lib.rs"), @r##" + assert_snapshot!(test_project.diff("src/lib.rs"), @r#" --- Original: src/lib.rs +++ Updated: src/lib.rs @@ -1,21 +1,19 @@ @@ -223,7 +223,7 @@ fn test_trailing_comma_in_inline_snapshot() { + @"new value", // comma here ); } - "##); + "#); } /// Test the old format of inline YAML snapshots with a leading `---` still passes diff --git a/cargo-insta/tests/functional/workspace.rs b/cargo-insta/tests/functional/workspace.rs index f2b40d38..7e29e1ed 100644 --- a/cargo-insta/tests/functional/workspace.rs +++ b/cargo-insta/tests/functional/workspace.rs @@ -88,7 +88,7 @@ fn test_root_crate_workspace_accept() { assert!(&output.status.success()); - assert_snapshot!(test_project.file_tree_diff(), @r###" + assert_snapshot!(test_project.file_tree_diff(), @r" --- Original file tree +++ Updated file tree @@ -1,8 +1,13 @@ @@ -105,7 +105,7 @@ fn test_root_crate_workspace_accept() { src/main.rs + src/snapshots + src/snapshots/root_crate_workspace_accept__root.snap - "### ); + " ); } /// Check that in a workspace with a default root crate, running `cargo insta @@ -145,7 +145,7 @@ fn test_root_crate_no_all() { assert!(&output.status.success()); - assert_snapshot!(test_project.file_tree_diff(), @r###" + assert_snapshot!(test_project.file_tree_diff(), @r" --- Original file tree +++ Updated file tree @@ -1,4 +1,5 @@ @@ -160,7 +160,7 @@ fn test_root_crate_no_all() { src/main.rs + src/snapshots + src/snapshots/root_crate_no_all__root.snap - "### ); + " ); } fn workspace_with_virtual_manifest(name: String) -> TestFiles { @@ -247,7 +247,7 @@ fn test_virtual_manifest_all() { assert!(&output.status.success()); - assert_snapshot!(test_project.file_tree_diff(), @r###" + assert_snapshot!(test_project.file_tree_diff(), @r" --- Original file tree +++ Updated file tree @@ -1,10 +1,15 @@ @@ -266,7 +266,7 @@ fn test_virtual_manifest_all() { member-2/src/lib.rs + member-2/src/snapshots + member-2/src/snapshots/virtual_manifest_all_member_2__member_2.snap - "### ); + " ); } /// Check that in a workspace with a virtual manifest, running `cargo insta test @@ -284,7 +284,7 @@ fn test_virtual_manifest_default() { assert!(&output.status.success()); - assert_snapshot!(test_project.file_tree_diff(), @r###" + assert_snapshot!(test_project.file_tree_diff(), @r" --- Original file tree +++ Updated file tree @@ -1,10 +1,15 @@ @@ -303,7 +303,7 @@ fn test_virtual_manifest_default() { member-2/src/lib.rs + member-2/src/snapshots + member-2/src/snapshots/virtual_manifest_default_member_2__member_2.snap - "### ); + " ); } /// Check that in a workspace with a virtual manifest, running `cargo insta test @@ -321,7 +321,7 @@ fn test_virtual_manifest_single_crate() { assert!(&output.status.success()); - assert_snapshot!(test_project.file_tree_diff(), @r###" + assert_snapshot!(test_project.file_tree_diff(), @r" --- Original file tree +++ Updated file tree @@ -1,9 +1,12 @@ @@ -337,7 +337,7 @@ fn test_virtual_manifest_single_crate() { member-2 member-2/Cargo.toml member-2/src - "### ); + " ); } use std::path::{Path, PathBuf}; @@ -943,7 +943,7 @@ fn test_inline() { assert!(output.status.success()); // Verify inline snapshot - assert_snapshot!(test_project.diff("src/lib.rs"), @r##" + assert_snapshot!(test_project.diff("src/lib.rs"), @r#" --- Original: src/lib.rs +++ Updated: src/lib.rs @@ -10,5 +10,5 @@ @@ -953,7 +953,7 @@ fn test_inline() { - insta::assert_snapshot!("This is an inline snapshot for manifest path test", @""); + insta::assert_snapshot!("This is an inline snapshot for manifest path test", @"This is an inline snapshot for manifest path test"); } - "##); + "#); assert_snapshot!(test_project.file_tree_diff(), @r" --- Original file tree +++ Updated file tree diff --git a/insta/src/content/json.rs b/insta/src/content/json.rs index e4dd5e67..49e3b8da 100644 --- a/insta/src/content/json.rs +++ b/insta/src/content/json.rs @@ -336,7 +336,7 @@ fn test_to_string() { (Content::from("cmdline"), Content::Seq(vec![])), (Content::from("extra"), Content::Map(vec![])), ])); - crate::assert_snapshot!(&json, @r###"{"environments":["development","production"],"cmdline":[],"extra":{}}"###); + crate::assert_snapshot!(&json, @r#"{"environments":["development","production"],"cmdline":[],"extra":{}}"#); } #[test] @@ -352,7 +352,7 @@ fn test_to_string_pretty() { (Content::from("cmdline"), Content::Seq(vec![])), (Content::from("extra"), Content::Map(vec![])), ])); - crate::assert_snapshot!(&json, @r###" + crate::assert_snapshot!(&json, @r#" { "environments": [ "development", @@ -361,7 +361,7 @@ fn test_to_string_pretty() { "cmdline": [], "extra": {} } - "###); + "#); } #[test] @@ -371,12 +371,12 @@ fn test_to_string_num_keys() { (Content::from(-23i32), Content::from(false)), ]); let json = to_string_pretty(&content); - crate::assert_snapshot!(&json, @r###" + crate::assert_snapshot!(&json, @r#" { "42": true, "-23": false } - "###); + "#); } #[test] @@ -466,7 +466,7 @@ fn test_to_string_pretty_complex() { ]); let json = to_string_pretty(&content); - crate::assert_snapshot!(&json, @r###" + crate::assert_snapshot!(&json, @r##" { "is_alive": true, "newtype_variant": { @@ -525,5 +525,5 @@ fn test_to_string_pretty_complex() { "unit": null, "crazy_string": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" } - "###); + "##); } diff --git a/insta/src/serialization.rs b/insta/src/serialization.rs index 749a2a86..48f64c9d 100644 --- a/insta/src/serialization.rs +++ b/insta/src/serialization.rs @@ -126,14 +126,14 @@ fn test_yaml_serialization() { ]), SerializationFormat::Yaml, ); - crate::assert_snapshot!(&yaml, @r###" + crate::assert_snapshot!(&yaml, @r" env: - ENVIRONMENT - production cmdline: - my-tool - run - "###); + "); let inline_yaml = serialize_content( Content::Map(vec![ @@ -151,12 +151,12 @@ fn test_yaml_serialization() { ]), SerializationFormat::Yaml, ); - crate::assert_snapshot!(&inline_yaml, @r###" + crate::assert_snapshot!(&inline_yaml, @r" env: - ENVIRONMENT - production cmdline: - my-tool - run - "###); + "); } diff --git a/insta/src/snapshot.rs b/insta/src/snapshot.rs index 3d872125..c6142b4b 100644 --- a/insta/src/snapshot.rs +++ b/insta/src/snapshot.rs @@ -860,28 +860,28 @@ fn names_of_path(path: &Path) -> (String, String) { #[test] fn test_names_of_path() { assert_debug_snapshot!( - names_of_path(Path::new("/src/snapshots/insta_tests__tests__name_foo.snap")), @r###" + names_of_path(Path::new("/src/snapshots/insta_tests__tests__name_foo.snap")), @r#" ( "name_foo", "insta_tests__tests", ) - "### + "# ); assert_debug_snapshot!( - names_of_path(Path::new("/src/snapshots/name_foo.snap")), @r###" + names_of_path(Path::new("/src/snapshots/name_foo.snap")), @r#" ( "name_foo", "", ) - "### + "# ); assert_debug_snapshot!( - names_of_path(Path::new("foo/src/snapshots/go1.20.5.snap")), @r###" + names_of_path(Path::new("foo/src/snapshots/go1.20.5.snap")), @r#" ( "go1.20.5", "", ) - "### + "# ); } @@ -1282,12 +1282,11 @@ fn test_empty_lines() { assert_snapshot!(r#"multiline content starting on first line final line - "#, @r###" + "#, @r" multiline content starting on first line final line - - "###); + "); assert_snapshot!(r#" multiline content starting on second line diff --git a/insta/src/utils.rs b/insta/src/utils.rs index f800252e..5325dd34 100644 --- a/insta/src/utils.rs +++ b/insta/src/utils.rs @@ -122,7 +122,7 @@ fn test_format_rust_expression() { use crate::assert_snapshot; assert_snapshot!(format_rust_expression("vec![1,2,3]"), @"vec![1, 2, 3]"); assert_snapshot!(format_rust_expression("vec![1,2,3].iter()"), @"vec![1, 2, 3].iter()"); - assert_snapshot!(format_rust_expression(r#" "aoeu""#), @r###""aoeu""###); - assert_snapshot!(format_rust_expression(r#" "aoe😄""#), @r###""aoe😄""###); + assert_snapshot!(format_rust_expression(r#" "aoeu""#), @r#""aoeu""#); + assert_snapshot!(format_rust_expression(r#" "aoe😄""#), @r#""aoe😄""#); assert_snapshot!(format_rust_expression("😄😄😄😄😄"), @"😄😄😄😄😄") } diff --git a/insta/tests/snapshots/test_redaction__foo_bar.snap b/insta/tests/snapshots/test_redaction__foo_bar.snap index b06fb5cc..f71ab16f 100644 --- a/insta/tests/snapshots/test_redaction__foo_bar.snap +++ b/insta/tests/snapshots/test_redaction__foo_bar.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "Selector::parse(\".foo.bar\").unwrap()" +expression: "Selector :: parse(\".foo.bar\").unwrap()" --- Selector { selectors: [ diff --git a/insta/tests/snapshots/test_redaction__foo_bar_alt.snap b/insta/tests/snapshots/test_redaction__foo_bar_alt.snap index 575b1565..aeb12a77 100644 --- a/insta/tests/snapshots/test_redaction__foo_bar_alt.snap +++ b/insta/tests/snapshots/test_redaction__foo_bar_alt.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "Selector::parse(\".foo[\\\"bar\\\"]\").unwrap()" +expression: "Selector :: parse(\".foo[\\\"bar\\\"]\").unwrap()" --- Selector { selectors: [ diff --git a/insta/tests/snapshots/test_redaction__foo_bar_deep.snap b/insta/tests/snapshots/test_redaction__foo_bar_deep.snap index 9cb30bd2..1203254b 100644 --- a/insta/tests/snapshots/test_redaction__foo_bar_deep.snap +++ b/insta/tests/snapshots/test_redaction__foo_bar_deep.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "Selector::parse(\".foo.bar.**\").unwrap()" +expression: "Selector :: parse(\".foo.bar.**\").unwrap()" --- Selector { selectors: [ diff --git a/insta/tests/snapshots/test_redaction__foo_bar_full_range.snap b/insta/tests/snapshots/test_redaction__foo_bar_full_range.snap index d7023538..9873e312 100644 --- a/insta/tests/snapshots/test_redaction__foo_bar_full_range.snap +++ b/insta/tests/snapshots/test_redaction__foo_bar_full_range.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "Selector::parse(\".foo.bar[]\").unwrap()" +expression: "Selector :: parse(\".foo.bar[]\").unwrap()" --- Selector { selectors: [ diff --git a/insta/tests/snapshots/test_redaction__foo_bar_range.snap b/insta/tests/snapshots/test_redaction__foo_bar_range.snap index a25e6cfd..84ba3e62 100644 --- a/insta/tests/snapshots/test_redaction__foo_bar_range.snap +++ b/insta/tests/snapshots/test_redaction__foo_bar_range.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "Selector::parse(\".foo.bar[10:20]\").unwrap()" +expression: "Selector :: parse(\".foo.bar[10:20]\").unwrap()" --- Selector { selectors: [ diff --git a/insta/tests/snapshots/test_redaction__foo_bar_range_from.snap b/insta/tests/snapshots/test_redaction__foo_bar_range_from.snap index 69555686..5da40cf1 100644 --- a/insta/tests/snapshots/test_redaction__foo_bar_range_from.snap +++ b/insta/tests/snapshots/test_redaction__foo_bar_range_from.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "Selector::parse(\".foo.bar[10:]\").unwrap()" +expression: "Selector :: parse(\".foo.bar[10:]\").unwrap()" --- Selector { selectors: [ diff --git a/insta/tests/snapshots/test_redaction__foo_bar_range_to.snap b/insta/tests/snapshots/test_redaction__foo_bar_range_to.snap index c97f4a85..4a7405be 100644 --- a/insta/tests/snapshots/test_redaction__foo_bar_range_to.snap +++ b/insta/tests/snapshots/test_redaction__foo_bar_range_to.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "Selector::parse(\".foo.bar[:10]\").unwrap()" +expression: "Selector :: parse(\".foo.bar[:10]\").unwrap()" --- Selector { selectors: [ diff --git a/insta/tests/snapshots/test_redaction__rounded_redaction.snap b/insta/tests/snapshots/test_redaction__rounded_redaction.snap index 24ae5e0f..2ef2d552 100644 --- a/insta/tests/snapshots/test_redaction__rounded_redaction.snap +++ b/insta/tests/snapshots/test_redaction__rounded_redaction.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&MyPoint { x: 1.0 / 3.0, y: 6.0 / 3.0 }" +expression: "&MyPoint { x: 1.0 / 3.0, y: 6.0 / 3.0, }" --- { "x": 0.3333, diff --git a/insta/tests/snapshots/test_redaction__user_json.snap b/insta/tests/snapshots/test_redaction__user_json.snap index 5aefc8bf..db9b1729 100644 --- a/insta/tests/snapshots/test_redaction__user_json.snap +++ b/insta/tests/snapshots/test_redaction__user_json.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 9999,\n username: \"jason_doe\".to_string(),\n email: Email(\"jason@example.com\".to_string()),\n extra: \"ssn goes here\".to_string(),\n }" +expression: "&User\n{\n id: 9999, username: \"jason_doe\".to_string(), email:\n Email(\"jason@example.com\".to_string()), extra:\n \"ssn goes here\".to_string(),\n}" --- { "id": "[id]", diff --git a/insta/tests/snapshots/test_redaction__user_json_flags.snap b/insta/tests/snapshots/test_redaction__user_json_flags.snap index d8bffbc8..6c5c3fa0 100644 --- a/insta/tests/snapshots/test_redaction__user_json_flags.snap +++ b/insta/tests/snapshots/test_redaction__user_json_flags.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 122,\n username: \"jason_doe\".to_string(),\n flags: vec![\"zzz\".into(), \"foo\".into(), \"aha\".into(),\n \"is_admin\".into()].into_iter().collect(),\n }" +expression: "&User\n{\n id: 122, username: \"jason_doe\".to_string(), flags:\n vec![\"zzz\".into(), \"foo\".into(), \"aha\".into(),\n \"is_admin\".into()].into_iter().collect(),\n}" --- { "id": "[id]", diff --git a/insta/tests/snapshots/test_redaction__user_json_flags_alt.snap b/insta/tests/snapshots/test_redaction__user_json_flags_alt.snap index 1b4cd2bf..70f97aa4 100644 --- a/insta/tests/snapshots/test_redaction__user_json_flags_alt.snap +++ b/insta/tests/snapshots/test_redaction__user_json_flags_alt.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 122,\n username: \"jason_doe\".to_string(),\n flags: MySet(vec![\"zzz\".into(), \"foo\".into(), \"aha\".into(),\n \"is_admin\".into()].into_iter().collect()),\n }" +expression: "&User\n{\n id: 122, username: \"jason_doe\".to_string(), flags:\n MySet(vec![\"zzz\".into(), \"foo\".into(), \"aha\".into(),\n \"is_admin\".into()].into_iter().collect()),\n}" --- { "flags": [ diff --git a/insta/tests/snapshots/test_redaction__user_json_settings.snap b/insta/tests/snapshots/test_redaction__user_json_settings.snap index 1f52ea5a..c8d13279 100644 --- a/insta/tests/snapshots/test_redaction__user_json_settings.snap +++ b/insta/tests/snapshots/test_redaction__user_json_settings.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 122,\n username: \"jason_doe\".to_string(),\n email: Email(\"jason@example.com\".to_string()),\n extra: \"ssn goes here\".to_string(),\n }" +expression: "&User\n{\n id: 122, username: \"jason_doe\".to_string(), email:\n Email(\"jason@example.com\".to_string()), extra:\n \"ssn goes here\".to_string(),\n}" --- { "id": "[id]", diff --git a/insta/tests/snapshots/test_redaction__user_json_settings_callback.snap b/insta/tests/snapshots/test_redaction__user_json_settings_callback.snap index f8aa7290..bf7f6658 100644 --- a/insta/tests/snapshots/test_redaction__user_json_settings_callback.snap +++ b/insta/tests/snapshots/test_redaction__user_json_settings_callback.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 1234,\n username: \"jason_doe\".to_string(),\n email: Email(\"jason@example.com\".to_string()),\n extra: \"extra here\".to_string(),\n }" +expression: "&User\n{\n id: 1234, username: \"jason_doe\".to_string(), email:\n Email(\"jason@example.com\".to_string()), extra: \"extra here\".to_string(),\n}" --- { "id": "[id]", diff --git a/insta/tests/snapshots/test_redaction__with_random_value.snap b/insta/tests/snapshots/test_redaction__with_random_value.snap index 29890987..f97843d5 100644 --- a/insta/tests/snapshots/test_redaction__with_random_value.snap +++ b/insta/tests/snapshots/test_redaction__with_random_value.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 42,\n username: \"john_doe\".to_string(),\n email: Email(\"john@example.com\".to_string()),\n extra: \"\".to_string(),\n }" +expression: "&User\n{\n id: 42, username: \"john_doe\".to_string(), email:\n Email(\"john@example.com\".to_string()), extra: \"\".to_string(),\n}" --- id: "[id]" username: john_doe diff --git a/insta/tests/snapshots/test_redaction__with_random_value_and_match_comma-2.snap b/insta/tests/snapshots/test_redaction__with_random_value_and_match_comma-2.snap index 137543e4..7fda7764 100644 --- a/insta/tests/snapshots/test_redaction__with_random_value_and_match_comma-2.snap +++ b/insta/tests/snapshots/test_redaction__with_random_value_and_match_comma-2.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 11,\n username: \"john_doe\".to_string(),\n email: Email(\"john@example.com\".to_string()),\n extra: \"\".to_string(),\n }" +expression: "&User\n{\n id: 11, username: \"john_doe\".to_string(), email:\n Email(\"john@example.com\".to_string()), extra: \"\".to_string(),\n}" --- id: "[id]" username: john_doe diff --git a/insta/tests/snapshots/test_redaction__with_random_value_and_match_comma.snap b/insta/tests/snapshots/test_redaction__with_random_value_and_match_comma.snap index 137543e4..7fda7764 100644 --- a/insta/tests/snapshots/test_redaction__with_random_value_and_match_comma.snap +++ b/insta/tests/snapshots/test_redaction__with_random_value_and_match_comma.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 11,\n username: \"john_doe\".to_string(),\n email: Email(\"john@example.com\".to_string()),\n extra: \"\".to_string(),\n }" +expression: "&User\n{\n id: 11, username: \"john_doe\".to_string(), email:\n Email(\"john@example.com\".to_string()), extra: \"\".to_string(),\n}" --- id: "[id]" username: john_doe diff --git a/insta/tests/snapshots/test_redaction__with_random_value_and_trailing_comma.snap b/insta/tests/snapshots/test_redaction__with_random_value_and_trailing_comma.snap index 137543e4..7fda7764 100644 --- a/insta/tests/snapshots/test_redaction__with_random_value_and_trailing_comma.snap +++ b/insta/tests/snapshots/test_redaction__with_random_value_and_trailing_comma.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 11,\n username: \"john_doe\".to_string(),\n email: Email(\"john@example.com\".to_string()),\n extra: \"\".to_string(),\n }" +expression: "&User\n{\n id: 11, username: \"john_doe\".to_string(), email:\n Email(\"john@example.com\".to_string()), extra: \"\".to_string(),\n}" --- id: "[id]" username: john_doe diff --git a/insta/tests/snapshots/test_redaction__with_random_value_inline_callback.snap b/insta/tests/snapshots/test_redaction__with_random_value_inline_callback.snap index 0aa80ead..582d0d76 100644 --- a/insta/tests/snapshots/test_redaction__with_random_value_inline_callback.snap +++ b/insta/tests/snapshots/test_redaction__with_random_value_inline_callback.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 23,\n username: \"john_doe\".to_string(),\n email: Email(\"john@example.com\".to_string()),\n extra: \"\".to_string(),\n }" +expression: "&User\n{\n id: 23, username: \"john_doe\".to_string(), email:\n Email(\"john@example.com\".to_string()), extra: \"\".to_string(),\n}" --- id: "[id]" username: john_doe diff --git a/insta/tests/snapshots/test_redaction__with_random_value_json_match.snap b/insta/tests/snapshots/test_redaction__with_random_value_json_match.snap index 5aefc8bf..db9b1729 100644 --- a/insta/tests/snapshots/test_redaction__with_random_value_json_match.snap +++ b/insta/tests/snapshots/test_redaction__with_random_value_json_match.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 9999,\n username: \"jason_doe\".to_string(),\n email: Email(\"jason@example.com\".to_string()),\n extra: \"ssn goes here\".to_string(),\n }" +expression: "&User\n{\n id: 9999, username: \"jason_doe\".to_string(), email:\n Email(\"jason@example.com\".to_string()), extra:\n \"ssn goes here\".to_string(),\n}" --- { "id": "[id]", diff --git a/insta/tests/snapshots/test_redaction__with_random_value_json_settings2.snap b/insta/tests/snapshots/test_redaction__with_random_value_json_settings2.snap index 5b08ad7a..cfef2a8d 100644 --- a/insta/tests/snapshots/test_redaction__with_random_value_json_settings2.snap +++ b/insta/tests/snapshots/test_redaction__with_random_value_json_settings2.snap @@ -1,6 +1,6 @@ --- source: insta/tests/test_redaction.rs -expression: "&User {\n id: 975,\n username: \"jason_doe\".to_string(),\n email: Email(\"jason@example.com\".to_string()),\n extra: \"ssn goes here\".to_string(),\n }" +expression: "&User\n{\n id: 975, username: \"jason_doe\".to_string(), email:\n Email(\"jason@example.com\".to_string()), extra:\n \"ssn goes here\".to_string(),\n}" --- { "id": "[id]", diff --git a/insta/tests/test_basic.rs b/insta/tests/test_basic.rs index 33b67611..da35a59b 100644 --- a/insta/tests/test_basic.rs +++ b/insta/tests/test_basic.rs @@ -129,9 +129,9 @@ fn test_trailing_crlf() { #[test] fn test_trailing_crlf_inline() { - insta::assert_snapshot!("foo\r\nbar\r\nbaz\r\n", @r#" + insta::assert_snapshot!("foo\r\nbar\r\nbaz\r\n", @r" foo bar baz - "#); + "); } diff --git a/insta/tests/test_inline.rs b/insta/tests/test_inline.rs index fe936908..c8d1c187 100644 --- a/insta/tests/test_inline.rs +++ b/insta/tests/test_inline.rs @@ -14,14 +14,14 @@ use std::thread; #[test] fn test_simple() { - assert_debug_snapshot!(vec![1, 2, 3, 4], @r###" + assert_debug_snapshot!(vec![1, 2, 3, 4], @r" [ 1, 2, 3, 4, ] - "###); + "); } #[test] @@ -56,9 +56,7 @@ fn test_unnamed_thread_single_line() { #[test] fn test_newline() { // https://github.com/mitsuhiko/insta/issues/39 - assert_snapshot!("\n", @r###" - - "###); + assert_snapshot!("\n", @""); } #[test] @@ -173,12 +171,12 @@ fn test_toml_inline() { #[cfg(feature = "json")] #[test] fn test_json_inline() { - assert_json_snapshot!(vec!["foo", "bar"], @r###" + assert_json_snapshot!(vec!["foo", "bar"], @r#" [ "foo", "bar" ] - "###); + "#); } #[cfg(feature = "yaml")] @@ -195,11 +193,11 @@ fn test_yaml_inline() { id: 42, username: "peter-pan".into(), email: "peterpan@wonderland.invalid".into() - }, @r###" + }, @r" id: 42 username: peter-pan email: peterpan@wonderland.invalid - "###); + "); } #[cfg(all(feature = "redactions", feature = "yaml"))] @@ -218,11 +216,11 @@ fn test_yaml_inline_redacted() { email: "peterpan@wonderland.invalid".into() }, { ".id" => "[user-id]" - }, @r###" + }, @r#" id: "[user-id]" username: peter-pan email: peterpan@wonderland.invalid - "###); + "#); } #[test] @@ -232,20 +230,20 @@ fn test_non_basic_plane() { #[test] fn test_multiline_with_empty_lines() { - assert_snapshot!("# first\nsecond\n third\n\n# alternative", @r###" + assert_snapshot!("# first\nsecond\n third\n\n# alternative", @r" # first second third # alternative - "###); + "); } #[cfg(feature = "json")] #[test] fn test_compact_json() { assert_compact_json_snapshot!((1..30).collect::>(), @"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]"); - assert_compact_json_snapshot!((1..34).collect::>(), @r###" + assert_compact_json_snapshot!((1..34).collect::>(), @r" [ 1, 2, @@ -281,7 +279,7 @@ fn test_compact_json() { 32, 33 ] - "###); + "); } #[test] @@ -300,14 +298,11 @@ fn test_inline_test_in_loop() { #[test] fn test_inline_snapshot_whitespace() { - assert_snapshot!("\n\nfoo\n\n bar\n\n", @r###" - - + assert_snapshot!("\n\nfoo\n\n bar\n\n", @r" foo bar - - "###); + "); } #[test] diff --git a/insta/tests/test_redaction.rs b/insta/tests/test_redaction.rs index ab461272..96752a84 100644 --- a/insta/tests/test_redaction.rs +++ b/insta/tests/test_redaction.rs @@ -121,12 +121,12 @@ fn test_with_random_value_and_match_comma() { match .. { ".id" => "[id]", }, - @r###" + @r#" id: "[id]" username: john_doe email: john@example.com extra: "" - "###, // comma here + "#, // comma here ); } @@ -322,14 +322,14 @@ fn test_redact_newtype_struct() { assert_json_snapshot!(wrapper, { r#".id"# => "[id]" - }, @r###" + }, @r#" { "id": "[id]", "username": "john_doe", "email": "john@example.com", "extra": "" } - "###); + "#); } #[cfg(feature = "yaml")] @@ -347,11 +347,11 @@ fn test_redact_newtype_enum() { }; assert_yaml_snapshot!(visitor, { r#".id"# => "[id]", - }, @r###" + }, @r#" Visitor: id: "[id]" name: my-name - "###); + "#); let admin = Role::Admin(User { id: 42, @@ -361,13 +361,13 @@ fn test_redact_newtype_enum() { }); assert_yaml_snapshot!(admin, { r#".id"# => "[id]", - }, @r###" + }, @r#" Admin: id: "[id]" username: john_doe email: john@example.com extra: "" - "###); + "#); } #[cfg(feature = "json")] @@ -386,7 +386,7 @@ fn test_redact_recursive() { assert_json_snapshot!(root, { ".**.id" => "[id]", - }, @r###" + }, @r#" { "id": "[id]", "next": { @@ -394,7 +394,7 @@ fn test_redact_recursive() { "next": null } } - "###); + "#); } #[cfg(feature = "yaml")] diff --git a/insta/tests/test_settings.rs b/insta/tests/test_settings.rs index da0c6ce2..8a6513b7 100644 --- a/insta/tests/test_settings.rs +++ b/insta/tests/test_settings.rs @@ -16,12 +16,12 @@ fn test_simple() { let mut settings = insta::Settings::new(); settings.set_sort_maps(true); settings.bind(|| { - assert_yaml_snapshot!(&map, @r###" + assert_yaml_snapshot!(&map, @r" a: first value b: second value c: third value d: fourth value - "###); + "); }); } @@ -38,12 +38,12 @@ fn test_bound_to_scope() { let mut settings = Settings::new(); settings.set_sort_maps(true); let _guard = settings.bind_to_scope(); - assert_yaml_snapshot!(&map, @r###" + assert_yaml_snapshot!(&map, @r" a: first value b: second value c: third value d: fourth value - "###); + "); } assert!(!Settings::clone_current().sort_maps()); @@ -59,12 +59,12 @@ fn test_settings_macro() { map.insert("d", "fourth value"); with_settings!({sort_maps => true}, { - insta::assert_yaml_snapshot!(&map, @r###" + insta::assert_yaml_snapshot!(&map, @r" a: first value b: second value c: third value d: fourth value - "###); + "); }); }