@@ -473,13 +473,16 @@ fn test_install_invalid() {
473
473
}
474
474
475
475
// Tests above should (maybe) be converted to shell out to rustpkg, too
476
-
476
+ # [ test ]
477
477
fn test_install_git ( ) {
478
478
let sysroot = test_sysroot ( ) ;
479
479
debug ! ( "sysroot = %s" , sysroot. to_str( ) ) ;
480
480
let temp_pkg_id = git_repo_pkg ( ) ;
481
481
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
+
483
486
writeFile ( & repo_subdir. push ( "main.rs" ) ,
484
487
"fn main() { let _x = (); }" ) ;
485
488
writeFile ( & repo_subdir. push ( "lib.rs" ) ,
@@ -494,30 +497,28 @@ fn test_install_git() {
494
497
temp_pkg_id. path. to_str( ) , repo. to_str( ) ) ;
495
498
// should have test, bench, lib, and main
496
499
command_line_test ( [ ~"install", temp_pkg_id. path . to_str ( ) ] , & repo) ;
500
+ let ws = repo. push ( ".rust" ) ;
497
501
// 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 ) ;
500
504
debug ! ( "exec = %s" , exec. to_str( ) ) ;
501
505
assert ! ( os:: path_exists( & exec) ) ;
502
506
assert ! ( is_rwx( & exec) ) ;
503
507
let _built_lib =
504
508
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 ( ) ) ;
510
511
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" ) ;
512
513
assert ! ( os:: path_exists( & built_test) ) ;
513
514
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" ) ;
515
516
assert ! ( os:: path_exists( & built_bench) ) ;
516
517
// 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 ) ;
518
519
assert ! ( !os:: path_exists( & test) ) ;
519
520
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 ) ;
521
522
debug ! ( "bench = %s" , bench. to_str( ) ) ;
522
523
assert ! ( !os:: path_exists( & bench) ) ;
523
524
}
@@ -563,6 +564,7 @@ fn test_package_ids_must_be_relative_path_like() {
563
564
564
565
}
565
566
567
+ #[test]
566
568
fn test_package_version() {
567
569
let local_path = " mockgithub. com/catamorphism/test_pkg_version";
568
570
let repo = init_git_repo(&Path(local_path));
@@ -578,28 +580,27 @@ fn test_package_version() {
578
580
" #[ bench] pub fn f( ) { ( ) ; } ");
579
581
add_git_tag(&repo_subdir, ~" 0.4 ");
580
582
583
+ // It won't pick up the 0.4 version because the dir isn't in the RUST_PATH, but...
581
584
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
- }
587
585
// This should look at the prefix, clone into a workspace, then build.
588
586
command_line_test([~" install", ~" mockgithub. com/catamorphism/test_pkg_version"],
589
587
&repo);
588
+ let ws = repo.push(" . rust");
589
+ // we can still match on the filename to make sure it contains the 0.4 version
590
590
assert!(match built_library_in_workspace(&temp_pkg_id,
591
- &repo ) {
591
+ &ws ) {
592
592
Some(p) => p.to_str().ends_with(fmt!(" 0.4 %s", os::consts::DLL_SUFFIX)),
593
593
None => false
594
594
});
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").
597
597
push(" mockgithub. com").
598
598
push(" catamorphism").
599
599
push(" test_pkg_version").
600
600
push(" test_pkg_version")));
601
601
}
602
602
603
+ #[test]
603
604
fn test_package_request_version() {
604
605
let local_path = " mockgithub. com/catamorphism/test_pkg_version";
605
606
let repo = init_git_repo(&Path(local_path));
0 commit comments