Skip to content

Commit 2c30a7f

Browse files
authored
Run with --force-update-snapshots (#749)
As well as isolating future diffs to changes that matter, helps identify a couple of issues; e.g. how the turbofish is formatted in the `Selector` expressions
1 parent 25cedbc commit 2c30a7f

30 files changed

+88
-94
lines changed

cargo-insta/tests/functional/inline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn test_trailing_comma_in_inline_snapshot() {
187187

188188
assert!(&output.status.success());
189189

190-
assert_snapshot!(test_project.diff("src/lib.rs"), @r##"
190+
assert_snapshot!(test_project.diff("src/lib.rs"), @r#"
191191
--- Original: src/lib.rs
192192
+++ Updated: src/lib.rs
193193
@@ -1,21 +1,19 @@
@@ -223,7 +223,7 @@ fn test_trailing_comma_in_inline_snapshot() {
223223
+ @"new value", // comma here
224224
);
225225
}
226-
"##);
226+
"#);
227227
}
228228

229229
/// Test the old format of inline YAML snapshots with a leading `---` still passes

cargo-insta/tests/functional/workspace.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn test_root_crate_workspace_accept() {
8888

8989
assert!(&output.status.success());
9090

91-
assert_snapshot!(test_project.file_tree_diff(), @r###"
91+
assert_snapshot!(test_project.file_tree_diff(), @r"
9292
--- Original file tree
9393
+++ Updated file tree
9494
@@ -1,8 +1,13 @@
@@ -105,7 +105,7 @@ fn test_root_crate_workspace_accept() {
105105
src/main.rs
106106
+ src/snapshots
107107
+ src/snapshots/root_crate_workspace_accept__root.snap
108-
"### );
108+
" );
109109
}
110110

111111
/// Check that in a workspace with a default root crate, running `cargo insta
@@ -145,7 +145,7 @@ fn test_root_crate_no_all() {
145145

146146
assert!(&output.status.success());
147147

148-
assert_snapshot!(test_project.file_tree_diff(), @r###"
148+
assert_snapshot!(test_project.file_tree_diff(), @r"
149149
--- Original file tree
150150
+++ Updated file tree
151151
@@ -1,4 +1,5 @@
@@ -160,7 +160,7 @@ fn test_root_crate_no_all() {
160160
src/main.rs
161161
+ src/snapshots
162162
+ src/snapshots/root_crate_no_all__root.snap
163-
"### );
163+
" );
164164
}
165165

166166
fn workspace_with_virtual_manifest(name: String) -> TestFiles {
@@ -247,7 +247,7 @@ fn test_virtual_manifest_all() {
247247

248248
assert!(&output.status.success());
249249

250-
assert_snapshot!(test_project.file_tree_diff(), @r###"
250+
assert_snapshot!(test_project.file_tree_diff(), @r"
251251
--- Original file tree
252252
+++ Updated file tree
253253
@@ -1,10 +1,15 @@
@@ -266,7 +266,7 @@ fn test_virtual_manifest_all() {
266266
member-2/src/lib.rs
267267
+ member-2/src/snapshots
268268
+ member-2/src/snapshots/virtual_manifest_all_member_2__member_2.snap
269-
"### );
269+
" );
270270
}
271271

272272
/// Check that in a workspace with a virtual manifest, running `cargo insta test
@@ -284,7 +284,7 @@ fn test_virtual_manifest_default() {
284284

285285
assert!(&output.status.success());
286286

287-
assert_snapshot!(test_project.file_tree_diff(), @r###"
287+
assert_snapshot!(test_project.file_tree_diff(), @r"
288288
--- Original file tree
289289
+++ Updated file tree
290290
@@ -1,10 +1,15 @@
@@ -303,7 +303,7 @@ fn test_virtual_manifest_default() {
303303
member-2/src/lib.rs
304304
+ member-2/src/snapshots
305305
+ member-2/src/snapshots/virtual_manifest_default_member_2__member_2.snap
306-
"### );
306+
" );
307307
}
308308

309309
/// Check that in a workspace with a virtual manifest, running `cargo insta test
@@ -321,7 +321,7 @@ fn test_virtual_manifest_single_crate() {
321321

322322
assert!(&output.status.success());
323323

324-
assert_snapshot!(test_project.file_tree_diff(), @r###"
324+
assert_snapshot!(test_project.file_tree_diff(), @r"
325325
--- Original file tree
326326
+++ Updated file tree
327327
@@ -1,9 +1,12 @@
@@ -337,7 +337,7 @@ fn test_virtual_manifest_single_crate() {
337337
member-2
338338
member-2/Cargo.toml
339339
member-2/src
340-
"### );
340+
" );
341341
}
342342

343343
use std::path::{Path, PathBuf};
@@ -943,7 +943,7 @@ fn test_inline() {
943943
assert!(output.status.success());
944944

945945
// Verify inline snapshot
946-
assert_snapshot!(test_project.diff("src/lib.rs"), @r##"
946+
assert_snapshot!(test_project.diff("src/lib.rs"), @r#"
947947
--- Original: src/lib.rs
948948
+++ Updated: src/lib.rs
949949
@@ -10,5 +10,5 @@
@@ -953,7 +953,7 @@ fn test_inline() {
953953
- insta::assert_snapshot!("This is an inline snapshot for manifest path test", @"");
954954
+ insta::assert_snapshot!("This is an inline snapshot for manifest path test", @"This is an inline snapshot for manifest path test");
955955
}
956-
"##);
956+
"#);
957957
assert_snapshot!(test_project.file_tree_diff(), @r"
958958
--- Original file tree
959959
+++ Updated file tree

insta/src/content/json.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ fn test_to_string() {
336336
(Content::from("cmdline"), Content::Seq(vec![])),
337337
(Content::from("extra"), Content::Map(vec![])),
338338
]));
339-
crate::assert_snapshot!(&json, @r###"{"environments":["development","production"],"cmdline":[],"extra":{}}"###);
339+
crate::assert_snapshot!(&json, @r#"{"environments":["development","production"],"cmdline":[],"extra":{}}"#);
340340
}
341341

342342
#[test]
@@ -352,7 +352,7 @@ fn test_to_string_pretty() {
352352
(Content::from("cmdline"), Content::Seq(vec![])),
353353
(Content::from("extra"), Content::Map(vec![])),
354354
]));
355-
crate::assert_snapshot!(&json, @r###"
355+
crate::assert_snapshot!(&json, @r#"
356356
{
357357
"environments": [
358358
"development",
@@ -361,7 +361,7 @@ fn test_to_string_pretty() {
361361
"cmdline": [],
362362
"extra": {}
363363
}
364-
"###);
364+
"#);
365365
}
366366

367367
#[test]
@@ -371,12 +371,12 @@ fn test_to_string_num_keys() {
371371
(Content::from(-23i32), Content::from(false)),
372372
]);
373373
let json = to_string_pretty(&content);
374-
crate::assert_snapshot!(&json, @r###"
374+
crate::assert_snapshot!(&json, @r#"
375375
{
376376
"42": true,
377377
"-23": false
378378
}
379-
"###);
379+
"#);
380380
}
381381

382382
#[test]
@@ -466,7 +466,7 @@ fn test_to_string_pretty_complex() {
466466
]);
467467
let json = to_string_pretty(&content);
468468

469-
crate::assert_snapshot!(&json, @r###"
469+
crate::assert_snapshot!(&json, @r##"
470470
{
471471
"is_alive": true,
472472
"newtype_variant": {
@@ -525,5 +525,5 @@ fn test_to_string_pretty_complex() {
525525
"unit": null,
526526
"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{|}~"
527527
}
528-
"###);
528+
"##);
529529
}

insta/src/serialization.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ fn test_yaml_serialization() {
126126
]),
127127
SerializationFormat::Yaml,
128128
);
129-
crate::assert_snapshot!(&yaml, @r###"
129+
crate::assert_snapshot!(&yaml, @r"
130130
env:
131131
- ENVIRONMENT
132132
- production
133133
cmdline:
134134
- my-tool
135135
- run
136-
"###);
136+
");
137137

138138
let inline_yaml = serialize_content(
139139
Content::Map(vec![
@@ -151,12 +151,12 @@ fn test_yaml_serialization() {
151151
]),
152152
SerializationFormat::Yaml,
153153
);
154-
crate::assert_snapshot!(&inline_yaml, @r###"
154+
crate::assert_snapshot!(&inline_yaml, @r"
155155
env:
156156
- ENVIRONMENT
157157
- production
158158
cmdline:
159159
- my-tool
160160
- run
161-
"###);
161+
");
162162
}

insta/src/snapshot.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -860,28 +860,28 @@ fn names_of_path(path: &Path) -> (String, String) {
860860
#[test]
861861
fn test_names_of_path() {
862862
assert_debug_snapshot!(
863-
names_of_path(Path::new("/src/snapshots/insta_tests__tests__name_foo.snap")), @r###"
863+
names_of_path(Path::new("/src/snapshots/insta_tests__tests__name_foo.snap")), @r#"
864864
(
865865
"name_foo",
866866
"insta_tests__tests",
867867
)
868-
"###
868+
"#
869869
);
870870
assert_debug_snapshot!(
871-
names_of_path(Path::new("/src/snapshots/name_foo.snap")), @r###"
871+
names_of_path(Path::new("/src/snapshots/name_foo.snap")), @r#"
872872
(
873873
"name_foo",
874874
"",
875875
)
876-
"###
876+
"#
877877
);
878878
assert_debug_snapshot!(
879-
names_of_path(Path::new("foo/src/snapshots/go1.20.5.snap")), @r###"
879+
names_of_path(Path::new("foo/src/snapshots/go1.20.5.snap")), @r#"
880880
(
881881
"go1.20.5",
882882
"",
883883
)
884-
"###
884+
"#
885885
);
886886
}
887887

@@ -1282,12 +1282,11 @@ fn test_empty_lines() {
12821282
assert_snapshot!(r#"multiline content starting on first line
12831283
12841284
final line
1285-
"#, @r###"
1285+
"#, @r"
12861286
multiline content starting on first line
12871287
12881288
final line
1289-
1290-
"###);
1289+
");
12911290

12921291
assert_snapshot!(r#"
12931292
multiline content starting on second line

insta/src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn test_format_rust_expression() {
122122
use crate::assert_snapshot;
123123
assert_snapshot!(format_rust_expression("vec![1,2,3]"), @"vec![1, 2, 3]");
124124
assert_snapshot!(format_rust_expression("vec![1,2,3].iter()"), @"vec![1, 2, 3].iter()");
125-
assert_snapshot!(format_rust_expression(r#" "aoeu""#), @r###""aoeu""###);
126-
assert_snapshot!(format_rust_expression(r#" "aoe😄""#), @r###""aoe😄""###);
125+
assert_snapshot!(format_rust_expression(r#" "aoeu""#), @r#""aoeu""#);
126+
assert_snapshot!(format_rust_expression(r#" "aoe😄""#), @r#""aoe😄""#);
127127
assert_snapshot!(format_rust_expression("😄😄😄😄😄"), @"😄😄😄😄😄")
128128
}

insta/tests/snapshots/test_redaction__foo_bar.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: insta/tests/test_redaction.rs
3-
expression: "Selector::parse(\".foo.bar\").unwrap()"
3+
expression: "Selector :: parse(\".foo.bar\").unwrap()"
44
---
55
Selector {
66
selectors: [

insta/tests/snapshots/test_redaction__foo_bar_alt.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: insta/tests/test_redaction.rs
3-
expression: "Selector::parse(\".foo[\\\"bar\\\"]\").unwrap()"
3+
expression: "Selector :: parse(\".foo[\\\"bar\\\"]\").unwrap()"
44
---
55
Selector {
66
selectors: [

insta/tests/snapshots/test_redaction__foo_bar_deep.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: insta/tests/test_redaction.rs
3-
expression: "Selector::parse(\".foo.bar.**\").unwrap()"
3+
expression: "Selector :: parse(\".foo.bar.**\").unwrap()"
44
---
55
Selector {
66
selectors: [

insta/tests/snapshots/test_redaction__foo_bar_full_range.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: insta/tests/test_redaction.rs
3-
expression: "Selector::parse(\".foo.bar[]\").unwrap()"
3+
expression: "Selector :: parse(\".foo.bar[]\").unwrap()"
44
---
55
Selector {
66
selectors: [

0 commit comments

Comments
 (0)