Get compile test passing
authorYehuda Katz <wycats@gmail.com>
Thu, 8 May 2014 20:33:04 +0000 (13:33 -0700)
committerYehuda Katz <wycats@gmail.com>
Thu, 8 May 2014 20:33:04 +0000 (13:33 -0700)
src/cargo/ops/cargo_compile.rs
tests/test_cargo_compile.rs

index a003e3075a43678b2522db9df258b5b9ac5947f3..5c6a7b52193cc22e634ce413195beec7209f9800 100644 (file)
@@ -33,11 +33,13 @@ pub fn compile(manifest_path: &str) -> CLIResult<()> {
 
     let config_paths = configs.find(&("paths".to_owned())).map(|v| v.clone()).unwrap_or_else(|| ConfigValue::new());
 
-    let paths = match config_paths.get_value() {
+    let mut paths: Vec<Path> = match config_paths.get_value() {
         &config::String(_) => return Err(CLIError::new("The path was configured as a String instead of a List", None, 1)),
         &config::List(ref list) => list.iter().map(|path| Path::new(path.as_slice())).collect()
     };
 
+    paths.push(Path::new(manifest_path).dir_path());
+
     let source = PathSource::new(paths);
     let summaries = try!(source.list().to_result(|err|
         CLIError::new(format!("Unable to list packages from {}", source), Some(err.to_str()), 1)));
index ba250808faf424cd197f2d8352e57f3c8553cfe7..8a6596695aa0091f8c1afba37b21b9ce77a17b23 100644 (file)
@@ -6,7 +6,7 @@ fn setup() {
 }
 
 // Currently doesn't pass due to the code being broken
-test!(cargo_compile_with_explicit_manifest_path {
+test!(cargo_compile {
     let p = project("foo")
         .file("Cargo.toml", r#"
             [project]
@@ -22,15 +22,14 @@ test!(cargo_compile_with_explicit_manifest_path {
         .file("src/foo.rs", r#"
             fn main() {
                 println!("i am foo");
-            }"#)
+            }
+        "#)
         .build();
 
-    println!("~~~~~~~");
-    p.cargo_process("cargo")
-      .args(["compile".to_owned(), "--manifest-path".to_owned(), "Cargo.toml".to_owned()])
+    p.cargo_process("cargo-compile")
+      .args([])
       .exec()
       .unwrap();
-    println!("~~~~~~~");
 
     assert_that(&p.root().join("target/foo"), existing_file());