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 33 34 35 36
|
diff --git a/tests/assert.rs b/tests/assert.rs
new file mode 100644
index 0000000..887383a
--- /dev/null
+++ b/tests/assert.rs
@@ -0,0 +1,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");
+}
diff --git a/tests/fixture/hello.txt b/tests/fixture/hello.txt
new file mode 100644
index 0000000..ce01362
--- /dev/null
+++ b/tests/fixture/hello.txt
@@ -0,0 +1 @@
+hello
|