@@ -1111,6 +1111,55 @@ fn test_extern_mod() {
1111
1111
assert ! ( os:: path_exists( & exec_file) && is_executable( & exec_file) ) ;
1112
1112
}
1113
1113
1114
+ #[ test]
1115
+ fn test_extern_mod_simpler ( ) {
1116
+ let dir = mkdtemp ( & os:: tmpdir ( ) , "test_extern_mod_simpler" ) . expect ( "test_extern_mod_simpler" ) ;
1117
+ let main_file = dir. push ( "main.rs" ) ;
1118
+ let lib_depend_dir = mkdtemp ( & os:: tmpdir ( ) , "foo" ) . expect ( "test_extern_mod_simpler" ) ;
1119
+ let aux_dir = lib_depend_dir. push_many ( [ "src" , "rust-awesomeness" ] ) ;
1120
+ assert ! ( os:: mkdir_recursive( & aux_dir, U_RWX ) ) ;
1121
+ let aux_pkg_file = aux_dir. push ( "lib.rs" ) ;
1122
+
1123
+ writeFile ( & aux_pkg_file, "pub mod bar { pub fn assert_true() { assert!(true); } }\n " ) ;
1124
+ assert ! ( os:: path_exists( & aux_pkg_file) ) ;
1125
+
1126
+ writeFile ( & main_file,
1127
+ "extern mod test = \" rust-awesomeness\" ;\n use test::bar;\
1128
+ fn main() { bar::assert_true(); }\n ") ;
1129
+
1130
+ command_line_test ( [ ~"install", ~"rust-awesomeness"] , & lib_depend_dir) ;
1131
+
1132
+ let exec_file = dir. push ( "out" ) ;
1133
+ // Be sure to extend the existing environment
1134
+ let env = Some ( [ ( ~"RUST_PATH ", lib_depend_dir. to_str ( ) ) ] + os:: env ( ) ) ;
1135
+ let rustpkg_exec = rustpkg_exec ( ) ;
1136
+ let rustc = rustpkg_exec. with_filename ( "rustc" ) ;
1137
+ debug ! ( "RUST_PATH=%s %s %s \n --sysroot %s -o %s" ,
1138
+ lib_depend_dir. to_str( ) ,
1139
+ rustc. to_str( ) ,
1140
+ main_file. to_str( ) ,
1141
+ test_sysroot( ) . to_str( ) ,
1142
+ exec_file. to_str( ) ) ;
1143
+
1144
+ let mut prog = run:: Process :: new ( rustc. to_str ( ) , [ main_file. to_str ( ) ,
1145
+ ~"--sysroot", test_sysroot ( ) . to_str ( ) ,
1146
+ ~"-o", exec_file. to_str ( ) ] ,
1147
+ run:: ProcessOptions {
1148
+ env : env,
1149
+ dir : Some ( & dir) ,
1150
+ in_fd : None ,
1151
+ out_fd : None ,
1152
+ err_fd : None
1153
+ } ) ;
1154
+ let outp = prog. finish_with_output ( ) ;
1155
+ if outp. status != 0 {
1156
+ fail ! ( "output was %s, error was %s" ,
1157
+ str :: from_utf8( outp. output) ,
1158
+ str :: from_utf8( outp. error) ) ;
1159
+ }
1160
+ assert ! ( os:: path_exists( & exec_file) && is_executable( & exec_file) ) ;
1161
+ }
1162
+
1114
1163
#[ test]
1115
1164
fn test_import_rustpkg ( ) {
1116
1165
let p_id = PkgId :: new ( "foo" ) ;
0 commit comments