]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/issue-4241.rs
Replace all ~"" with "".to_owned()
[rust.git] / src / test / run-pass / issue-4241.rs
index 173f76434d303b0feb0f58296e48e48bad7f1379..f3e37921ba4202ba1b5aea3290abc4d74c6ef89d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,10 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// xfail-fast
-// xfail-test needs networking
+// ignore-test needs networking
 
-extern mod extra;
+extern crate extra;
 
 use extra::net::tcp::TcpSocketBuf;
 
@@ -44,17 +43,16 @@ enum Result {
 }
 
 priv fn parse_list(len: uint, io: @io::Reader) -> Result {
-  let mut list: ~[Result] = ~[];
-    len.times(proc() {
-    let v =
-        match io.read_char() {
-        '$' => parse_bulk(io),
-        ':' => parse_int(io),
-         _ => fail!()
-    });
-    list.push(v);
+    let mut list: ~[Result] = ~[];
+    for _ in range(0, len) {
+        let v = match io.read_char() {
+            '$' => parse_bulk(io),
+            ':' => parse_int(io),
+             _ => fail!()
+        };
+        list.push(v);
     }
-  return List(list);
+    return List(list);
 }
 
 priv fn chop(s: ~str) -> ~str {
@@ -99,12 +97,12 @@ enum Result {
 }
 
 priv fn cmd_to_str(cmd: ~[~str]) -> ~str {
-  let mut res = ~"*";
+  let mut res = "*".to_owned();
   res.push_str(cmd.len().to_str());
   res.push_str("\r\n");
     for s in cmd.iter() {
-    res.push_str([~"$", s.len().to_str(), ~"\r\n",
-                  (*s).clone(), ~"\r\n"].concat() );
+    res.push_str(["$".to_owned(), s.len().to_str(), "\r\n".to_owned(),
+                  (*s).clone(), "\r\n".to_owned()].concat() );
     }
   res
 }
@@ -119,7 +117,7 @@ fn query(cmd: ~[~str], sb: TcpSocketBuf) -> Result {
 
 fn query2(cmd: ~[~str]) -> Result {
   let _cmd = cmd_to_str(cmd);
-    io::with_str_reader(~"$3\r\nXXX\r\n")(|sb| {
+    io::with_str_reader("$3\r\nXXX\r\n".to_owned())(|sb| {
     let res = parse_response(@sb as @io::Reader);
     println!("{:?}", res);
     res