Skip to content

Commit

Permalink
Consolidate a couple of test files (#608)
Browse files Browse the repository at this point in the history
Not as extreme as #459, but
consolidates a few files that were separate binaries and 1-2 functions.
  • Loading branch information
max-sixty authored Sep 22, 2024
1 parent 8baf9a3 commit caa1e8f
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 56 deletions.
5 changes: 5 additions & 0 deletions insta/tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: insta/tests/test_advanced.rs
expression: "&value"
---
1
5 changes: 5 additions & 0 deletions insta/tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: insta/tests/test_advanced.rs
expression: "&value"
---
2
5 changes: 5 additions & 0 deletions insta/tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: insta/tests/test_advanced.rs
expression: "&value"
---
3
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: insta/tests/test_bugs.rs
source: insta/tests/test_basic.rs
expression: "\"foo\\r\\nbar\\r\\nbaz\""
---
foo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: insta/tests/test_bugs.rs
source: insta/tests/test_basic.rs
expression: "\"foo\\r\\nbar\\r\\nbaz\\r\\n\""
---
foo
Expand Down
5 changes: 0 additions & 5 deletions insta/tests/snapshots/[email protected]

This file was deleted.

5 changes: 0 additions & 5 deletions insta/tests/snapshots/[email protected]

This file was deleted.

5 changes: 0 additions & 5 deletions insta/tests/snapshots/[email protected]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
use insta::{allow_duplicates, assert_debug_snapshot};

#[cfg(feature = "filters")]
#[test]
fn test_basic_filter() {
use insta::{assert_snapshot, with_settings};
with_settings!({filters => vec![
(r"\b[[:xdigit:]]{8}\b", "[SHORT_HEX]")
]}, {
assert_snapshot!("Hello DEADBEEF!", @"Hello [SHORT_HEX]!");
})
}

#[cfg(feature = "json")]
#[test]
fn test_basic_suffixes() {
for value in [1, 2, 3] {
insta::with_settings!({snapshot_suffix => value.to_string()}, {
insta::assert_json_snapshot!(&value);
});
}
}

#[test]
fn test_basic_duplicates_passes() {
allow_duplicates! {
Expand Down
19 changes: 19 additions & 0 deletions insta/tests/test_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,22 @@ fn insta_sort_order() {
insta::assert_yaml_snapshot!(m);
});
}

#[test]
fn test_crlf() {
insta::assert_snapshot!("foo\r\nbar\r\nbaz");
}

#[test]
fn test_trailing_crlf() {
insta::assert_snapshot!("foo\r\nbar\r\nbaz\r\n");
}

#[test]
fn test_trailing_crlf_inline() {
insta::assert_snapshot!("foo\r\nbar\r\nbaz\r\n", @r#"
foo
bar
baz
"#);
}
18 changes: 0 additions & 18 deletions insta/tests/test_bugs.rs

This file was deleted.

12 changes: 0 additions & 12 deletions insta/tests/test_filters.rs

This file was deleted.

9 changes: 0 additions & 9 deletions insta/tests/test_suffixes.rs

This file was deleted.

0 comments on commit caa1e8f

Please sign in to comment.