about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2013-10-05 19:49:32 -0700
committerKevin Ballard <kevin@sb.org>2013-10-15 22:18:30 -0700
commitd6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd (patch)
treee197783b86700e71d94c9bc6d0254eb25b16cc0c /src/test
parented539e14712539473c3e89604cb69e2307110772 (diff)
downloadrust-d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd.tar.gz
rust-d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd.zip
path2: Adjust the API to remove all the _str mutation methods
Add a new trait BytesContainer that is implemented for both byte vectors
and strings.

Convert Path::from_vec and ::from_str to one function, Path::new().

Remove all the _str-suffixed mutation methods (push, join, with_*,
set_*) and modify the non-suffixed versions to use BytesContainer.
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.rs12
-rw-r--r--src/test/run-pass/stat.rs4
-rw-r--r--src/test/run-pass/tempfile.rs24
8 files changed, 29 insertions, 29 deletions
diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs
index 8a5cb016a73..6ce289620fb 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::from_str(env!("CFG_SRC_DIR"))
-        .join_str("src/test/bench/shootout-k-nucleotide.data");
+    let mut path = Path::new(env!("CFG_SRC_DIR"));
+    path.push("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 addb43c4995..77c3a0e3983 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::from_str("./shootout-fasta.data"),
+        io::file_writer(&Path::new("./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 58ec5d44071..c0464dcc676 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::from_str(env!("CFG_SRC_DIR"))
-            .join_str("src/test/bench/shootout-k-nucleotide.data");
+        let mut path = Path::new(env!("CFG_SRC_DIR"));
+        path.push("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 170645f4404..c86a438344a 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::from_str(path), 0xFFFF);
+            os::make_dir(&Path::new(path), 0xFFFF);
         } else {
-            io::mk_file_writer(&Path::from_str(path), [io::Create]);
+            io::mk_file_writer(&Path::new(path), [io::Create]);
         }
     }
 
     fn abs_path(path: &str) -> Path {
-        os::getcwd().join_path(&Path::from_str(path))
+        os::getcwd().join_path(&Path::new(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 01d895d1bcf..f860426ffd2 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::from_str("blah");
+    let path = path::Path::new("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 608624670fc..76a1d32705b 100644
--- a/src/test/run-pass/rename-directory.rs
+++ b/src/test/run-pass/rename-directory.rs
@@ -25,9 +25,9 @@ fn rename_directory() {
 
         let tmpdir = TempDir::new("rename_directory").expect("rename_directory failed");
         let tmpdir = tmpdir.path();
-        let old_path = tmpdir.join_many_str(["foo", "bar", "baz"]);
+        let old_path = tmpdir.join_many(["foo", "bar", "baz"]);
         assert!(os::mkdir_recursive(&old_path, U_RWX));
-        let test_file = &old_path.join_str("temp.txt");
+        let test_file = &old_path.join("temp.txt");
 
         /* Write the temp input file */
         let ostream = do test_file.with_c_str |fromp| {
@@ -46,11 +46,11 @@ fn rename_directory() {
         }
         assert_eq!(libc::fclose(ostream), (0u as libc::c_int));
 
-        let new_path = tmpdir.join_many_str(["quux", "blat"]);
+        let new_path = tmpdir.join_many(["quux", "blat"]);
         assert!(os::mkdir_recursive(&new_path, U_RWX));
-        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"])));
+        assert!(os::rename_file(&old_path, &new_path.join("newdir")));
+        assert!(os::path_is_dir(&new_path.join("newdir")));
+        assert!(os::path_exists(&new_path.join_many(["newdir", "temp.txt"])));
     }
 }
 
diff --git a/src/test/run-pass/stat.rs b/src/test/run-pass/stat.rs
index 5cd62368aa2..aa0661d49a2 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::from_str("."), "").unwrap();
-    let path = dir.path().join_str("file");
+    let dir = tempfile::TempDir::new_in(&Path::new("."), "").unwrap();
+    let path = dir.path().join("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 80e63396350..837194fcf9f 100644
--- a/src/test/run-pass/tempfile.rs
+++ b/src/test/run-pass/tempfile.rs
@@ -28,7 +28,7 @@ use std::cell::Cell;
 
 fn test_tempdir() {
     let path = {
-        let p = TempDir::new_in(&Path::from_str("."), "foobar").unwrap();
+        let p = TempDir::new_in(&Path::new("."), "foobar").unwrap();
         let p = p.path();
         assert!(ends_with(p.as_vec(), bytes!("foobar")));
         p.clone()
@@ -84,7 +84,7 @@ 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::from_str("frob");
+    let path = Path::new("frob");
     let cwd = os::getcwd();
     debug2!("recursive_mkdir_rel: Making: {} in cwd {} [{:?}]", path.display(),
            cwd.display(), os::path_exists(&path));
@@ -95,21 +95,21 @@ fn recursive_mkdir_rel() {
 }
 
 fn recursive_mkdir_dot() {
-    let dot = Path::from_str(".");
+    let dot = Path::new(".");
     assert!(os::mkdir_recursive(&dot,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
-    let dotdot = Path::from_str("..");
+    let dotdot = Path::new("..");
     assert!(os::mkdir_recursive(&dotdot,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
 }
 
 fn recursive_mkdir_rel_2() {
-    let path = Path::from_str("./frob/baz");
+    let path = Path::new("./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.dir_path()));
-    let path2 = Path::from_str("quux/blat");
+    let path2 = Path::new("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));
@@ -124,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.join_str("foo");
+    let root = tmpdir.join("foo");
 
     debug2!("making {}", root.display());
     assert!(os::make_dir(&root, 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::make_dir(&root.join("foo"), rwx));
+    assert!(os::make_dir(&root.join("foo").join("bar"), rwx));
+    assert!(os::make_dir(&root.join("foo").join("bar").join("blat"), rwx));
     assert!(os::remove_dir_recursive(&root));
     assert!(!os::path_exists(&root));
-    assert!(!os::path_exists(&root.join_str("bar")));
-    assert!(!os::path_exists(&root.join_str("bar").join_str("blat")));
+    assert!(!os::path_exists(&root.join("bar")));
+    assert!(!os::path_exists(&root.join("bar").join("blat")));
 }
 
 fn in_tmpdir(f: &fn()) {