Integration tests working
authorCarlhuda <wycats+carl@gmail.com>
Thu, 20 Mar 2014 01:25:14 +0000 (18:25 -0700)
committerCarlhuda <wycats+carl@gmail.com>
Thu, 20 Mar 2014 01:25:14 +0000 (18:25 -0700)
Next up: cleanup

Makefile
libs/hamcrest-rust
tests/test_cargo_compile.rs
tests/tests.rs

index 99b7559f842088eafec7d56f623dfcc2f74052c4..ddbf0d1f8bd40dfdde9aa524fb3dee8627f8e2ea 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ $(HAMMER): $(wildcard libs/hammer.rs/src/*.rs)
 $(TOML): $(wildcard libs/rust-toml/src/toml/*.rs)
        cd libs/rust-toml && make
 
-$(HAMCREST): $(wildcard libs/hamcrest-rust/src/*.rs)
+$(HAMCREST): $(wildcard libs/hamcrest-rust/src/hamcrest/*.rs)
        cd libs/hamcrest-rust && make
 
 # === Cargo
index 95f531ad8c726a832f28d171bde2860c77ec7619..39f00624492fd648631041eadf1301a08cd2a482 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 95f531ad8c726a832f28d171bde2860c77ec7619
+Subproject commit 39f00624492fd648631041eadf1301a08cd2a482
index 48690aa3bb45cbeed2edeb6baf345608f9fad1ea..d4a1aab01a70214d86016b656ef17d365796beb9 100644 (file)
@@ -1,7 +1,31 @@
 use std;
 use support::project;
+use hamcrest::{SelfDescribing,Description,Matcher,assert_that};
 use cargo;
 
+#[deriving(Clone,Eq)]
+pub struct ExistingFile;
+
+impl SelfDescribing for ExistingFile {
+  fn describe_to(&self, desc: &mut Description) {
+    desc.append_text("an existing file");
+  }
+}
+
+impl Matcher<Path> for ExistingFile {
+  fn matches(&self, actual: &Path) -> bool {
+    actual.exists()
+  }
+
+  fn describe_mismatch(&self, actual: &Path, desc: &mut Description) {
+    desc.append_text(format!("`{}` was missing", actual.display()));
+  }
+}
+
+pub fn existing_file() -> ExistingFile {
+  ExistingFile
+}
+
 fn setup() {
 
 }
@@ -39,6 +63,7 @@ test!(cargo_compile_with_explicit_manifest_path {
       Err(e) => println!("err: {}", e)
     }
 
+    assert_that(p.root().join("target/foo/bar"), existing_file());
     assert!(p.root().join("target/foo").exists(), "the executable exists");
 
     let o = cargo::util::process("foo")
index 9e51bc5596a23a19c7feabceb46afe2e3b6540d4..3c74087d7411c7788e71f1d412b45442a831c1a8 100644 (file)
@@ -2,6 +2,7 @@
 #[allow(deprecated_owned_vector)];
 
 extern crate cargo;
+extern crate hamcrest;
 
 macro_rules! test(
     ($name:ident $expr:expr) => (