Skip to content

Commit

Permalink
Consolidate a couple of test files
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 committed Sep 22, 2024
1 parent 8baf9a3 commit 104714b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
use insta::{allow_duplicates, assert_debug_snapshot};
use insta::{assert_snapshot, with_settings};

#[cfg(feature = "filters")]
#[test]
fn test_basic_filter() {
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() {
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 104714b

Please sign in to comment.