File: test_binary.rs

package info (click to toggle)
rust-insta 1.43.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,020 kB
  • sloc: makefile: 2
file content (32 lines) | stat: -rw-r--r-- 872 bytes parent folder | download
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
30
31
32
#[test]
fn test_binary_snapshot() {
    insta::assert_binary_snapshot!(".txt", b"test".to_vec());
}

#[test]
#[should_panic(expected = "'.new' is not allowed as a file extension")]
fn test_new_extension() {
    insta::assert_binary_snapshot!(".new", b"test".to_vec());
}

#[test]
#[should_panic(expected = "\"test\" does not match the format \"name.extension\"")]
fn test_malformed_name_and_extension() {
    insta::assert_binary_snapshot!("test", b"test".to_vec());
}

#[test]
#[should_panic(expected = "file extensions starting with 'new.' are not allowed")]
fn test_extension_starting_with_new() {
    insta::assert_binary_snapshot!(".new.gz", b"test".to_vec());
}

#[test]
fn test_multipart_extension() {
    insta::assert_binary_snapshot!(".tar.gz", b"test".to_vec());
}

#[test]
fn test_named() {
    insta::assert_binary_snapshot!("name.json", b"null".to_vec());
}