about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/bench/core-std.rs4
-rw-r--r--src/test/bench/shootout-fasta.rs2
-rw-r--r--src/test/bench/shootout-k-nucleotide-pipes.rs4
-rw-r--r--src/test/run-pass/glob-std.rs6
-rw-r--r--src/test/run-pass/issue-3424.rs2
-rw-r--r--src/test/run-pass/rename-directory.rs14
-rw-r--r--src/test/run-pass/stat.rs4
-rw-r--r--src/test/run-pass/tempfile.rs50
8 files changed, 45 insertions, 41 deletions
diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs
index 5222c4f59b7..8a5cb016a73 100644
--- a/src/test/bench/core-std.rs
+++ b/src/test/bench/core-std.rs
@@ -73,8 +73,8 @@ fn read_line() {
     use std::rt::io::file::FileInfo;
     use std::rt::io::buffered::BufferedReader;
 
-    let path = Path(env!("CFG_SRC_DIR"))
-        .push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
+    let path = Path::from_str(env!("CFG_SRC_DIR"))
+        .join_str("src/test/bench/shootout-k-nucleotide.data");
 
     for _ in range(0, 3) {
         let mut reader = BufferedReader::new(path.open_reader(Open).unwrap());
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index 53da752fdc4..addb43c4995 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -122,7 +122,7 @@ fn main() {
     };
 
     let writer = if os::getenv("RUST_BENCH").is_some() {
-        io::file_writer(&Path("./shootout-fasta.data"),
+        io::file_writer(&Path::from_str("./shootout-fasta.data"),
                         [io::Truncate, io::Create]).unwrap()
     } else {
         io::stdout()
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs
index 445b28b693c..58ec5d44071 100644
--- a/src/test/bench/shootout-k-nucleotide-pipes.rs
+++ b/src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -164,8 +164,8 @@ fn main() {
     let rdr = if os::getenv("RUST_BENCH").is_some() {
         // FIXME: Using this compile-time env variable is a crummy way to
         // get to this massive data set, but include_bin! chokes on it (#2598)
-        let path = Path(env!("CFG_SRC_DIR"))
-            .push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
+        let path = Path::from_str(env!("CFG_SRC_DIR"))
+            .join_str("src/test/bench/shootout-k-nucleotide.data");
         ~path.open_reader(Open).unwrap() as ~Reader
     } else {
         ~stdio::stdin() as ~Reader
diff --git a/src/test/run-pass/glob-std.rs b/src/test/run-pass/glob-std.rs
index 08843c28a04..170645f4404 100644
--- a/src/test/run-pass/glob-std.rs
+++ b/src/test/run-pass/glob-std.rs
@@ -20,14 +20,14 @@ use std::{io, os, unstable};
 pub fn main() {
     fn mk_file(path: &str, directory: bool) {
         if directory {
-            os::make_dir(&Path(path), 0xFFFF);
+            os::make_dir(&Path::from_str(path), 0xFFFF);
         } else {
-            io::mk_file_writer(&Path(path), [io::Create]);
+            io::mk_file_writer(&Path::from_str(path), [io::Create]);
         }
     }
 
     fn abs_path(path: &str) -> Path {
-        os::getcwd().push_many(Path(path).components)
+        os::getcwd().join_path(&Path::from_str(path))
     }
 
     fn glob_vec(pattern: &str) -> ~[Path] {
diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs
index a40d1cf1c6e..01d895d1bcf 100644
--- a/src/test/run-pass/issue-3424.rs
+++ b/src/test/run-pass/issue-3424.rs
@@ -23,7 +23,7 @@ fn tester()
 {
     let loader: rsrc_loader = |_path| {result::Ok(~"more blah")};
 
-    let path = path::Path("blah");
+    let path = path::Path::from_str("blah");
     assert!(loader(&path).is_ok());
 }
 
diff --git a/src/test/run-pass/rename-directory.rs b/src/test/run-pass/rename-directory.rs
index 007ab381a5f..608624670fc 100644
--- a/src/test/run-pass/rename-directory.rs
+++ b/src/test/run-pass/rename-directory.rs
@@ -25,12 +25,12 @@ fn rename_directory() {
 
         let tmpdir = TempDir::new("rename_directory").expect("rename_directory failed");
         let tmpdir = tmpdir.path();
-        let old_path = tmpdir.push_many(["foo", "bar", "baz"]);
+        let old_path = tmpdir.join_many_str(["foo", "bar", "baz"]);
         assert!(os::mkdir_recursive(&old_path, U_RWX));
-        let test_file = &old_path.push("temp.txt");
+        let test_file = &old_path.join_str("temp.txt");
 
         /* Write the temp input file */
-        let ostream = do test_file.to_str().with_c_str |fromp| {
+        let ostream = do test_file.with_c_str |fromp| {
             do "w+b".with_c_str |modebuf| {
                 libc::fopen(fromp, modebuf)
             }
@@ -46,11 +46,11 @@ fn rename_directory() {
         }
         assert_eq!(libc::fclose(ostream), (0u as libc::c_int));
 
-        let new_path = tmpdir.push_many(["quux", "blat"]);
+        let new_path = tmpdir.join_many_str(["quux", "blat"]);
         assert!(os::mkdir_recursive(&new_path, U_RWX));
-        assert!(os::rename_file(&old_path, &new_path.push("newdir")));
-        assert!(os::path_is_dir(&new_path.push("newdir")));
-        assert!(os::path_exists(&new_path.push_many(["newdir", "temp.txt"])));
+        assert!(os::rename_file(&old_path, &new_path.join_str("newdir")));
+        assert!(os::path_is_dir(&new_path.join_str("newdir")));
+        assert!(os::path_exists(&new_path.join_many_str(["newdir", "temp.txt"])));
     }
 }
 
diff --git a/src/test/run-pass/stat.rs b/src/test/run-pass/stat.rs
index 67b84d6c93c..5cd62368aa2 100644
--- a/src/test/run-pass/stat.rs
+++ b/src/test/run-pass/stat.rs
@@ -18,8 +18,8 @@ use std::io;
 use std::os;
 
 pub fn main() {
-    let dir = tempfile::TempDir::new_in(&Path("."), "").unwrap();
-    let path = dir.path().push("file");
+    let dir = tempfile::TempDir::new_in(&Path::from_str("."), "").unwrap();
+    let path = dir.path().join_str("file");
 
     {
         match io::file_writer(&path, [io::Create, io::Truncate]) {
diff --git a/src/test/run-pass/tempfile.rs b/src/test/run-pass/tempfile.rs
index 2937a08b7b6..80e63396350 100644
--- a/src/test/run-pass/tempfile.rs
+++ b/src/test/run-pass/tempfile.rs
@@ -28,12 +28,15 @@ use std::cell::Cell;
 
 fn test_tempdir() {
     let path = {
-        let p = TempDir::new_in(&Path("."), "foobar").unwrap();
+        let p = TempDir::new_in(&Path::from_str("."), "foobar").unwrap();
         let p = p.path();
-        assert!(p.to_str().ends_with("foobar"));
+        assert!(ends_with(p.as_vec(), bytes!("foobar")));
         p.clone()
     };
     assert!(!os::path_exists(&path));
+    fn ends_with(v: &[u8], needle: &[u8]) -> bool {
+        v.len() >= needle.len() && v.slice_from(v.len()-needle.len()) == needle
+    }
 }
 
 fn test_rm_tempdir() {
@@ -81,10 +84,10 @@ fn test_rm_tempdir() {
 // Ideally these would be in std::os but then core would need
 // to depend on std
 fn recursive_mkdir_rel() {
-    let path = Path("frob");
-    debug2!("recursive_mkdir_rel: Making: {} in cwd {} [{:?}]", path.to_str(),
-           os::getcwd().to_str(),
-           os::path_exists(&path));
+    let path = Path::from_str("frob");
+    let cwd = os::getcwd();
+    debug2!("recursive_mkdir_rel: Making: {} in cwd {} [{:?}]", path.display(),
+           cwd.display(), os::path_exists(&path));
     assert!(os::mkdir_recursive(&path,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
     assert!(os::path_is_dir(&path));
     assert!(os::mkdir_recursive(&path,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
@@ -92,25 +95,26 @@ fn recursive_mkdir_rel() {
 }
 
 fn recursive_mkdir_dot() {
-    let dot = Path(".");
+    let dot = Path::from_str(".");
     assert!(os::mkdir_recursive(&dot,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
-    let dotdot = Path("..");
+    let dotdot = Path::from_str("..");
     assert!(os::mkdir_recursive(&dotdot,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
 }
 
 fn recursive_mkdir_rel_2() {
-    let path = Path("./frob/baz");
-    debug2!("recursive_mkdir_rel_2: Making: {} in cwd {} [{:?}]", path.to_str(),
-           os::getcwd().to_str(), os::path_exists(&path));
+    let path = Path::from_str("./frob/baz");
+    let cwd = os::getcwd();
+    debug2!("recursive_mkdir_rel_2: Making: {} in cwd {} [{:?}]", path.display(),
+           cwd.display(), os::path_exists(&path));
     assert!(os::mkdir_recursive(&path, (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
         assert!(os::path_is_dir(&path));
-    assert!(os::path_is_dir(&path.pop()));
-    let path2 = Path("quux/blat");
-    debug2!("recursive_mkdir_rel_2: Making: {} in cwd {}", path2.to_str(),
-           os::getcwd().to_str());
+    assert!(os::path_is_dir(&path.dir_path()));
+    let path2 = Path::from_str("quux/blat");
+    debug2!("recursive_mkdir_rel_2: Making: {} in cwd {}", path2.display(),
+           cwd.display());
     assert!(os::mkdir_recursive(&path2, (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
         assert!(os::path_is_dir(&path2));
-    assert!(os::path_is_dir(&path2.pop()));
+    assert!(os::path_is_dir(&path2.dir_path()));
 }
 
 // Ideally this would be in core, but needs TempFile
@@ -120,17 +124,17 @@ pub fn test_rmdir_recursive_ok() {
     let tmpdir = TempDir::new("test").expect("test_rmdir_recursive_ok: \
                                               couldn't create temp dir");
     let tmpdir = tmpdir.path();
-    let root = tmpdir.push("foo");
+    let root = tmpdir.join_str("foo");
 
-    debug2!("making {}", root.to_str());
+    debug2!("making {}", root.display());
     assert!(os::make_dir(&root, rwx));
-    assert!(os::make_dir(&root.push("foo"), rwx));
-    assert!(os::make_dir(&root.push("foo").push("bar"), rwx));
-    assert!(os::make_dir(&root.push("foo").push("bar").push("blat"), rwx));
+    assert!(os::make_dir(&root.join_str("foo"), rwx));
+    assert!(os::make_dir(&root.join_str("foo").join_str("bar"), rwx));
+    assert!(os::make_dir(&root.join_str("foo").join_str("bar").join_str("blat"), rwx));
     assert!(os::remove_dir_recursive(&root));
     assert!(!os::path_exists(&root));
-    assert!(!os::path_exists(&root.push("bar")));
-    assert!(!os::path_exists(&root.push("bar").push("blat")));
+    assert!(!os::path_exists(&root.join_str("bar")));
+    assert!(!os::path_exists(&root.join_str("bar").join_str("blat")));
 }
 
 fn in_tmpdir(f: &fn()) {