about summary refs log tree commit diff
path: root/src/librustpkg/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustpkg/tests.rs')
-rw-r--r--src/librustpkg/tests.rs94
1 files changed, 49 insertions, 45 deletions
diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs
index 5401a30a86c..5e867951b54 100644
--- a/src/librustpkg/tests.rs
+++ b/src/librustpkg/tests.rs
@@ -63,7 +63,7 @@ fn fake_ctxt(sysroot: Path, workspace: &Path) -> BuildContext {
 fn fake_pkg() -> PkgId {
     let sn = ~"bogus";
     PkgId {
-        path: Path::new(sn.as_slice()),
+        path: Path::init(sn.as_slice()),
         short_name: sn,
         version: NoVersion
     }
@@ -71,7 +71,7 @@ fn fake_pkg() -> PkgId {
 
 fn git_repo_pkg() -> PkgId {
     PkgId {
-        path: Path::new("mockgithub.com/catamorphism/test-pkg"),
+        path: Path::init("mockgithub.com/catamorphism/test-pkg"),
         short_name: ~"test-pkg",
         version: NoVersion
     }
@@ -79,7 +79,7 @@ fn git_repo_pkg() -> PkgId {
 
 fn git_repo_pkg_with_tag(a_tag: ~str) -> PkgId {
     PkgId {
-        path: Path::new("mockgithub.com/catamorphism/test-pkg"),
+        path: Path::init("mockgithub.com/catamorphism/test-pkg"),
         short_name: ~"test-pkg",
         version: Tagged(a_tag)
     }
@@ -479,7 +479,7 @@ fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~
 fn lib_output_file_name(workspace: &Path, short_name: &str) -> Path {
     debug!("lib_output_file_name: given {} and short name {}",
            workspace.display(), short_name);
-    library_in_workspace(&Path::new(short_name),
+    library_in_workspace(&Path::init(short_name),
                          short_name,
                          Build,
                          workspace,
@@ -752,12 +752,12 @@ fn test_package_ids_must_be_relative_path_like() {
     });
 
     cond.trap(|(p, e)| {
-        let abs = os::make_absolute(&Path::new("foo/bar/quux"));
+        let abs = os::make_absolute(&Path::init("foo/bar/quux"));
         assert_eq!(p, abs);
         assert!("absolute pkgid" == e);
         whatever.clone()
     }).inside(|| {
-        let zp = os::make_absolute(&Path::new("foo/bar/quux"));
+        let zp = os::make_absolute(&Path::init("foo/bar/quux"));
         // FIXME (#9639): This needs to handle non-utf8 paths
         let z = PkgId::new(zp.as_str().unwrap());
         assert_eq!(~"foo-0.1", z.to_str());
@@ -768,7 +768,7 @@ fn test_package_ids_must_be_relative_path_like() {
 #[test]
 fn test_package_version() {
     let local_path = "mockgithub.com/catamorphism/test_pkg_version";
-    let repo = init_git_repo(&Path::new(local_path));
+    let repo = init_git_repo(&Path::init(local_path));
     let repo = repo.path();
     let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test_pkg_version"]);
     debug!("Writing files in: {}", repo_subdir.display());
@@ -808,7 +808,7 @@ fn test_package_version() {
 #[test]
 fn test_package_request_version() {
     let local_path = "mockgithub.com/catamorphism/test_pkg_version";
-    let repo = init_git_repo(&Path::new(local_path));
+    let repo = init_git_repo(&Path::init(local_path));
     let repo = repo.path();
     let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test_pkg_version"]);
     debug!("Writing files in: {}", repo_subdir.display());
@@ -827,7 +827,7 @@ fn test_package_request_version() {
 
     command_line_test([~"install", format!("{}\\#0.3", local_path)], repo);
 
-    assert!(match installed_library_in_workspace(&Path::new("test_pkg_version"),
+    assert!(match installed_library_in_workspace(&Path::init("test_pkg_version"),
                                                  &repo.join(".rust")) {
         Some(p) => {
             debug!("installed: {}", p.display());
@@ -841,7 +841,7 @@ fn test_package_request_version() {
             == repo.join_many([".rust", "bin", "test_pkg_version"]));
 
     let mut dir = target_build_dir(&repo.join(".rust"));
-    dir.push(&Path::new("src/mockgithub.com/catamorphism/test_pkg_version-0.3"));
+    dir.push(&Path::init("src/mockgithub.com/catamorphism/test_pkg_version-0.3"));
     debug!("dir = {}", dir.display());
     assert!(dir.is_dir());
     assert!(dir.join("version-0.3-file.txt").exists());
@@ -858,7 +858,7 @@ fn rustpkg_install_url_2() {
 
 #[test]
 fn rustpkg_library_target() {
-    let foo_repo = init_git_repo(&Path::new("foo"));
+    let foo_repo = init_git_repo(&Path::init("foo"));
     let foo_repo = foo_repo.path();
     let package_dir = foo_repo.join("foo");
 
@@ -874,7 +874,7 @@ fn rustpkg_library_target() {
 
     add_git_tag(&package_dir, ~"1.0");
     command_line_test([~"install", ~"foo"], foo_repo);
-    assert_lib_exists(&foo_repo.join(".rust"), &Path::new("foo"), ExactRevision(~"1.0"));
+    assert_lib_exists(&foo_repo.join(".rust"), &Path::init("foo"), ExactRevision(~"1.0"));
 }
 
 #[test]
@@ -885,18 +885,19 @@ fn rustpkg_local_pkg() {
 }
 
 #[test]
+#[ignore(reason="busted")]
 fn package_script_with_default_build() {
     let dir = create_local_package(&PkgId::new("fancy-lib"));
     let dir = dir.path();
     debug!("dir = {}", dir.display());
     let mut source = test_sysroot().dir_path();
     source.pop(); source.pop();
-    let source = Path::new(file!()).dir_path().join_many(
+    let source = Path::init(file!()).dir_path().join_many(
         [~"testsuite", ~"pass", ~"src", ~"fancy-lib", ~"pkg.rs"]);
     debug!("package_script_with_default_build: {}", source.display());
     fs::copy(&source, &dir.join_many(["src", "fancy-lib-0.1", "pkg.rs"]));
     command_line_test([~"install", ~"fancy-lib"], dir);
-    assert_lib_exists(dir, &Path::new("fancy-lib"), NoVersion);
+    assert_lib_exists(dir, &Path::init("fancy-lib"), NoVersion);
     assert!(target_build_dir(dir).join_many([~"fancy-lib", ~"generated.rs"]).exists());
     let generated_path = target_build_dir(dir).join_many([~"fancy-lib", ~"generated.rs"]);
     debug!("generated path = {}", generated_path.display());
@@ -927,7 +928,7 @@ fn rustpkg_install_no_arg() {
               "fn main() { let _x = (); }");
     debug!("install_no_arg: dir = {}", package_dir.display());
     command_line_test([~"install"], &package_dir);
-    assert_lib_exists(&tmp, &Path::new("foo"), NoVersion);
+    assert_lib_exists(&tmp, &Path::init("foo"), NoVersion);
 }
 
 #[test]
@@ -950,7 +951,7 @@ fn rustpkg_clean_no_arg() {
 #[test]
 fn rust_path_test() {
     let dir_for_path = TempDir::new("more_rust").expect("rust_path_test failed");
-    let dir = mk_workspace(dir_for_path.path(), &Path::new("foo"), &NoVersion);
+    let dir = mk_workspace(dir_for_path.path(), &Path::init("foo"), &NoVersion);
     debug!("dir = {}", dir.display());
     writeFile(&dir.join("main.rs"), "fn main() { let _x = (); }");
 
@@ -991,9 +992,9 @@ fn rust_path_contents() {
 fn rust_path_parse() {
     os::setenv("RUST_PATH", "/a/b/c:/d/e/f:/g/h/i");
     let paths = rust_path();
-    assert!(paths.contains(&Path::new("/g/h/i")));
-    assert!(paths.contains(&Path::new("/d/e/f")));
-    assert!(paths.contains(&Path::new("/a/b/c")));
+    assert!(paths.contains(&Path::init("/g/h/i")));
+    assert!(paths.contains(&Path::init("/d/e/f")));
+    assert!(paths.contains(&Path::init("/a/b/c")));
     os::unsetenv("RUST_PATH");
 }
 
@@ -1373,8 +1374,8 @@ fn multiple_workspaces() {
 // Copy the exact same package into directory B and install it
 // Set the RUST_PATH to A:B
 // Make a third package that uses foo, make sure we can build/install it
-    let (a_loc, _pkg_dir) = mk_temp_workspace(&Path::new("foo"), &NoVersion);
-    let (b_loc, _pkg_dir) = mk_temp_workspace(&Path::new("foo"), &NoVersion);
+    let (a_loc, _pkg_dir) = mk_temp_workspace(&Path::init("foo"), &NoVersion);
+    let (b_loc, _pkg_dir) = mk_temp_workspace(&Path::init("foo"), &NoVersion);
     let (a_loc, b_loc) = (a_loc.path(), b_loc.path());
     debug!("Trying to install foo in {}", a_loc.display());
     command_line_test([~"install", ~"foo"], a_loc);
@@ -1399,7 +1400,7 @@ fn rust_path_hack_test(hack_flag: bool) {
    let p_id = PkgId::new("foo");
    let workspace = create_local_package(&p_id);
    let workspace = workspace.path();
-   let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace");
+   let dest_workspace = mk_empty_workspace(&Path::init("bar"), &NoVersion, "dest_workspace");
    let dest_workspace = dest_workspace.path();
    let foo_path = workspace.join_many(["src", "foo-0.1"]);
    let rust_path = Some(~[(~"RUST_PATH",
@@ -1408,11 +1409,11 @@ fn rust_path_hack_test(hack_flag: bool) {
                foo_path.as_str().unwrap()))]);
    command_line_test_with_env(~[~"install"] + if hack_flag { ~[~"--rust-path-hack"] } else { ~[] } +
                                ~[~"foo"], dest_workspace, rust_path);
-   assert_lib_exists(dest_workspace, &Path::new("foo"), NoVersion);
+   assert_lib_exists(dest_workspace, &Path::init("foo"), NoVersion);
    assert_executable_exists(dest_workspace, "foo");
    assert_built_library_exists(dest_workspace, "foo");
    assert_built_executable_exists(dest_workspace, "foo");
-   assert!(!lib_exists(workspace, &Path::new("foo"), NoVersion));
+   assert!(!lib_exists(workspace, &Path::init("foo"), NoVersion));
    assert!(!executable_exists(workspace, "foo"));
    assert!(!built_library_exists(workspace, "foo"));
    assert!(!built_executable_exists(workspace, "foo"));
@@ -1447,15 +1448,15 @@ fn rust_path_hack_cwd() {
    fs::mkdir_recursive(&cwd, io::UserRWX);
    writeFile(&cwd.join("lib.rs"), "pub fn f() { }");
 
-   let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace");
+   let dest_workspace = mk_empty_workspace(&Path::init("bar"), &NoVersion, "dest_workspace");
    let dest_workspace = dest_workspace.path();
    // FIXME (#9639): This needs to handle non-utf8 paths
    let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]);
    command_line_test_with_env([~"install", ~"--rust-path-hack", ~"foo"], &cwd, rust_path);
    debug!("Checking that foo exists in {}", dest_workspace.display());
-   assert_lib_exists(dest_workspace, &Path::new("foo"), NoVersion);
+   assert_lib_exists(dest_workspace, &Path::init("foo"), NoVersion);
    assert_built_library_exists(dest_workspace, "foo");
-   assert!(!lib_exists(&cwd, &Path::new("foo"), NoVersion));
+   assert!(!lib_exists(&cwd, &Path::init("foo"), NoVersion));
    assert!(!built_library_exists(&cwd, "foo"));
 }
 
@@ -1468,15 +1469,15 @@ fn rust_path_hack_multi_path() {
    writeFile(&subdir.join("lib.rs"), "pub fn f() { }");
    let name = ~"foo/bar/quux";
 
-   let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace");
+   let dest_workspace = mk_empty_workspace(&Path::init("bar"), &NoVersion, "dest_workspace");
    let dest_workspace = dest_workspace.path();
    // FIXME (#9639): This needs to handle non-utf8 paths
    let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]);
    command_line_test_with_env([~"install", ~"--rust-path-hack", name.clone()], &subdir, rust_path);
    debug!("Checking that {} exists in {}", name, dest_workspace.display());
-   assert_lib_exists(dest_workspace, &Path::new("quux"), NoVersion);
+   assert_lib_exists(dest_workspace, &Path::init("quux"), NoVersion);
    assert_built_library_exists(dest_workspace, name);
-   assert!(!lib_exists(&subdir, &Path::new("quux"), NoVersion));
+   assert!(!lib_exists(&subdir, &Path::init("quux"), NoVersion));
    assert!(!built_library_exists(&subdir, name));
 }
 
@@ -1489,15 +1490,15 @@ fn rust_path_hack_install_no_arg() {
    assert!(make_dir_rwx(&source_dir));
    writeFile(&source_dir.join("lib.rs"), "pub fn f() { }");
 
-   let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace");
+   let dest_workspace = mk_empty_workspace(&Path::init("bar"), &NoVersion, "dest_workspace");
    let dest_workspace = dest_workspace.path();
    // FIXME (#9639): This needs to handle non-utf8 paths
    let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]);
    command_line_test_with_env([~"install", ~"--rust-path-hack"], &source_dir, rust_path);
    debug!("Checking that foo exists in {}", dest_workspace.display());
-   assert_lib_exists(dest_workspace, &Path::new("foo"), NoVersion);
+   assert_lib_exists(dest_workspace, &Path::init("foo"), NoVersion);
    assert_built_library_exists(dest_workspace, "foo");
-   assert!(!lib_exists(&source_dir, &Path::new("foo"), NoVersion));
+   assert!(!lib_exists(&source_dir, &Path::init("foo"), NoVersion));
    assert!(!built_library_exists(cwd, "foo"));
 }
 
@@ -1509,7 +1510,7 @@ fn rust_path_hack_build_no_arg() {
    assert!(make_dir_rwx(&source_dir));
    writeFile(&source_dir.join("lib.rs"), "pub fn f() { }");
 
-   let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace");
+   let dest_workspace = mk_empty_workspace(&Path::init("bar"), &NoVersion, "dest_workspace");
    let dest_workspace = dest_workspace.path();
    // FIXME (#9639): This needs to handle non-utf8 paths
    let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]);
@@ -1547,7 +1548,7 @@ fn rust_path_hack_build_with_dependency() {
 fn rust_path_install_target() {
     let dir_for_path = TempDir::new(
         "source_workspace").expect("rust_path_install_target failed");
-    let mut dir = mk_workspace(dir_for_path.path(), &Path::new("foo"), &NoVersion);
+    let mut dir = mk_workspace(dir_for_path.path(), &Path::init("foo"), &NoVersion);
     debug!("dir = {}", dir.display());
     writeFile(&dir.join("main.rs"), "fn main() { let _x = (); }");
     let dir_to_install_to = TempDir::new(
@@ -1659,7 +1660,7 @@ fn notrans_flag_fail() {
                           workspace, None, BAD_FLAG_CODE);
         assert!(!built_executable_exists(workspace, "foo"));
         assert!(!object_file_exists(workspace, "foo"));
-        assert!(!lib_exists(workspace, &Path::new("foo"), NoVersion));
+        assert!(!lib_exists(workspace, &Path::init("foo"), NoVersion));
     }
 }
 
@@ -1926,9 +1927,9 @@ fn test_recursive_deps() {
     command_line_test_with_env([~"install", ~"a"],
                                a_workspace,
                                environment);
-    assert_lib_exists(a_workspace, &Path::new("a"), NoVersion);
-    assert_lib_exists(b_workspace, &Path::new("b"), NoVersion);
-    assert_lib_exists(b_workspace, &Path::new("c"), NoVersion);
+    assert_lib_exists(a_workspace, &Path::init("a"), NoVersion);
+    assert_lib_exists(b_workspace, &Path::init("b"), NoVersion);
+    assert_lib_exists(b_workspace, &Path::init("c"), NoVersion);
 }
 
 #[test]
@@ -1936,7 +1937,7 @@ fn test_install_to_rust_path() {
     let p_id = PkgId::new("foo");
     let second_workspace = create_local_package(&p_id);
     let second_workspace = second_workspace.path();
-    let first_workspace = mk_empty_workspace(&Path::new("p"), &NoVersion, "dest");
+    let first_workspace = mk_empty_workspace(&Path::init("p"), &NoVersion, "dest");
     let first_workspace = first_workspace.path();
     // FIXME (#9639): This needs to handle non-utf8 paths
     let rust_path = Some(~[(~"RUST_PATH",
@@ -1983,7 +1984,7 @@ fn test_target_specific_install_dir() {
                        ~"foo"],
                       workspace);
     assert!(workspace.join_many([~"lib", host_triple()]).is_dir());
-    assert_lib_exists(workspace, &Path::new("foo"), NoVersion);
+    assert_lib_exists(workspace, &Path::init("foo"), NoVersion);
     assert!(fs::readdir(&workspace.join("lib")).len() == 1);
     assert!(workspace.join("bin").is_dir());
     assert_executable_exists(workspace, "foo");
@@ -2059,7 +2060,7 @@ fn correct_package_name_with_rust_path_hack() {
     let bar_id = PkgId::new("bar");
     let foo_workspace = create_local_package(&foo_id);
     let foo_workspace = foo_workspace.path();
-    let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace");
+    let dest_workspace = mk_empty_workspace(&Path::init("bar"), &NoVersion, "dest_workspace");
     let dest_workspace = dest_workspace.path();
 
     writeFile(&dest_workspace.join_many(["src", "bar-0.1", "main.rs"]),
@@ -2315,6 +2316,7 @@ fn find_sources_in_cwd() {
 }
 
 #[test]
+#[ignore(reason="busted")]
 fn test_c_dependency_ok() {
     // Pkg has a custom build script that adds a single C file as a dependency, and
     // registers a hook to build it if it's not fresh
@@ -2328,7 +2330,7 @@ fn test_c_dependency_ok() {
     writeFile(&dir.join_many(["src", "cdep-0.1", "foo.c"]), "void f() {}");
 
     debug!("dir = {}", dir.display());
-    let source = Path::new(file!()).dir_path().join_many(
+    let source = Path::init(file!()).dir_path().join_many(
         [~"testsuite", ~"pass", ~"src", ~"c-dependencies", ~"pkg.rs"]);
     fs::copy(&source, &dir.join_many([~"src", ~"cdep-0.1", ~"pkg.rs"]));
     command_line_test([~"build", ~"cdep"], dir);
@@ -2340,6 +2342,7 @@ fn test_c_dependency_ok() {
 }
 
 #[test]
+#[ignore(reason="busted")]
 fn test_c_dependency_no_rebuilding() {
     let dir = create_local_package(&PkgId::new("cdep"));
     let dir = dir.path();
@@ -2349,7 +2352,7 @@ fn test_c_dependency_no_rebuilding() {
     writeFile(&dir.join_many(["src", "cdep-0.1", "foo.c"]), "void f() {}");
 
     debug!("dir = {}", dir.display());
-    let source = Path::new(file!()).dir_path().join_many(
+    let source = Path::init(file!()).dir_path().join_many(
         [~"testsuite", ~"pass", ~"src", ~"c-dependencies", ~"pkg.rs"]);
     fs::copy(&source, &dir.join_many([~"src", ~"cdep-0.1", ~"pkg.rs"]));
     command_line_test([~"build", ~"cdep"], dir);
@@ -2373,6 +2376,7 @@ fn test_c_dependency_no_rebuilding() {
 }
 
 #[test]
+#[ignore(reason="busted")]
 fn test_c_dependency_yes_rebuilding() {
     let dir = create_local_package(&PkgId::new("cdep"));
     let dir = dir.path();
@@ -2382,7 +2386,7 @@ fn test_c_dependency_yes_rebuilding() {
     let c_file_name = dir.join_many(["src", "cdep-0.1", "foo.c"]);
     writeFile(&c_file_name, "void f() {}");
 
-    let source = Path::new(file!()).dir_path().join_many(
+    let source = Path::init(file!()).dir_path().join_many(
         [~"testsuite", ~"pass", ~"src", ~"c-dependencies", ~"pkg.rs"]);
     let target = dir.join_many([~"src", ~"cdep-0.1", ~"pkg.rs"]);
     debug!("Copying {} -> {}", source.display(), target.display());