Skip to content

Commit 5fd47c7

Browse files
committed
rustpkg: Re-enable some more tests
1 parent 996989c commit 5fd47c7

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

src/librustpkg/tests.rs

+22-21
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,16 @@ fn test_install_invalid() {
473473
}
474474

475475
// Tests above should (maybe) be converted to shell out to rustpkg, too
476-
476+
#[test]
477477
fn test_install_git() {
478478
let sysroot = test_sysroot();
479479
debug!("sysroot = %s", sysroot.to_str());
480480
let temp_pkg_id = git_repo_pkg();
481481
let repo = init_git_repo(&temp_pkg_id.path);
482-
let repo_subdir = repo.push("mockgithub.com").push("catamorphism").push("test_pkg");
482+
debug!("repo = %s", repo.to_str());
483+
let repo_subdir = repo.push("mockgithub.com").push("catamorphism").push("test-pkg");
484+
debug!("repo_subdir = %s", repo_subdir.to_str());
485+
483486
writeFile(&repo_subdir.push("main.rs"),
484487
"fn main() { let _x = (); }");
485488
writeFile(&repo_subdir.push("lib.rs"),
@@ -494,30 +497,28 @@ fn test_install_git() {
494497
temp_pkg_id.path.to_str(), repo.to_str());
495498
// should have test, bench, lib, and main
496499
command_line_test([~"install", temp_pkg_id.path.to_str()], &repo);
500+
let ws = repo.push(".rust");
497501
// Check that all files exist
498-
debug!("Checking for files in %s", repo.to_str());
499-
let exec = target_executable_in_workspace(&temp_pkg_id, &repo);
502+
debug!("Checking for files in %s", ws.to_str());
503+
let exec = target_executable_in_workspace(&temp_pkg_id, &ws);
500504
debug!("exec = %s", exec.to_str());
501505
assert!(os::path_exists(&exec));
502506
assert!(is_rwx(&exec));
503507
let _built_lib =
504508
built_library_in_workspace(&temp_pkg_id,
505-
&repo).expect("test_install_git: built lib should exist");
506-
let lib = target_library_in_workspace(&temp_pkg_id, &repo);
507-
debug!("lib = %s", lib.to_str());
508-
assert!(os::path_exists(&lib));
509-
assert!(is_rwx(&lib));
509+
&ws).expect("test_install_git: built lib should exist");
510+
assert_lib_exists(&ws, temp_pkg_id.short_name, temp_pkg_id.version.clone());
510511
let built_test = built_test_in_workspace(&temp_pkg_id,
511-
&repo).expect("test_install_git: built test should exist");
512+
&ws).expect("test_install_git: built test should exist");
512513
assert!(os::path_exists(&built_test));
513514
let built_bench = built_bench_in_workspace(&temp_pkg_id,
514-
&repo).expect("test_install_git: built bench should exist");
515+
&ws).expect("test_install_git: built bench should exist");
515516
assert!(os::path_exists(&built_bench));
516517
// And that the test and bench executables aren't installed
517-
let test = target_test_in_workspace(&temp_pkg_id, &repo);
518+
let test = target_test_in_workspace(&temp_pkg_id, &ws);
518519
assert!(!os::path_exists(&test));
519520
debug!("test = %s", test.to_str());
520-
let bench = target_bench_in_workspace(&temp_pkg_id, &repo);
521+
let bench = target_bench_in_workspace(&temp_pkg_id, &ws);
521522
debug!("bench = %s", bench.to_str());
522523
assert!(!os::path_exists(&bench));
523524
}
@@ -563,6 +564,7 @@ fn test_package_ids_must_be_relative_path_like() {
563564
564565
}
565566
567+
#[test]
566568
fn test_package_version() {
567569
let local_path = "mockgithub.com/catamorphism/test_pkg_version";
568570
let repo = init_git_repo(&Path(local_path));
@@ -578,28 +580,27 @@ fn test_package_version() {
578580
"#[bench] pub fn f() { (); }");
579581
add_git_tag(&repo_subdir, ~"0.4");
580582
583+
// It won't pick up the 0.4 version because the dir isn't in the RUST_PATH, but...
581584
let temp_pkg_id = PkgId::new("mockgithub.com/catamorphism/test_pkg_version");
582-
match temp_pkg_id.version {
583-
ExactRevision(~"0.4") => (),
584-
_ => fail!(fmt!("test_package_version: package version was %?, expected Some(0.4)",
585-
temp_pkg_id.version))
586-
}
587585
// This should look at the prefix, clone into a workspace, then build.
588586
command_line_test([~"install", ~"mockgithub.com/catamorphism/test_pkg_version"],
589587
&repo);
588+
let ws = repo.push(".rust");
589+
// we can still match on the filename to make sure it contains the 0.4 version
590590
assert!(match built_library_in_workspace(&temp_pkg_id,
591-
&repo) {
591+
&ws) {
592592
Some(p) => p.to_str().ends_with(fmt!("0.4%s", os::consts::DLL_SUFFIX)),
593593
None => false
594594
});
595-
assert!(built_executable_in_workspace(&temp_pkg_id, &repo)
596-
== Some(repo.push("build").
595+
assert!(built_executable_in_workspace(&temp_pkg_id, &ws)
596+
== Some(ws.push("build").
597597
push("mockgithub.com").
598598
push("catamorphism").
599599
push("test_pkg_version").
600600
push("test_pkg_version")));
601601
}
602602
603+
#[test]
603604
fn test_package_request_version() {
604605
let local_path = "mockgithub.com/catamorphism/test_pkg_version";
605606
let repo = init_git_repo(&Path(local_path));

0 commit comments

Comments
 (0)