File: assert.rs

package info (click to toggle)
rust-assert-fs 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 228 kB
  • sloc: makefile: 2
file content (23 lines) | stat: -rw-r--r-- 529 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use assert_fs::prelude::*;
use predicates::prelude::*;

#[test]
fn code_example() {
    let temp = assert_fs::TempDir::new().unwrap();
    let input_file = temp.child("foo.txt");
    input_file.touch().unwrap();

    // ... do something with input_file ...

    input_file.assert("");
    temp.child("bar.txt").assert(predicate::path::missing());

    temp.close().unwrap();
}

#[test]
#[should_panic]
fn verify_failure_output() {
    let f = assert_fs::fixture::ChildPath::new("Cargo.toml");
    f.assert("Not real content");
}