]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/class-impl-very-parameterized-trait.rs
Replace all ~"" with "".to_owned()
[rust.git] / src / test / run-pass / class-impl-very-parameterized-trait.rs
index baa82dbb2deb6668ec9aaa32050b385fc04118a5..360e82cf8fdacf00671e18bf758f0b9c26724cab 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-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,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// xfail-fast
 
 use std::cmp;
 
+#[deriving(Show)]
 enum cat_type { tuxedo, tabby, tortoiseshell }
 
 impl cmp::Eq for cat_type {
@@ -27,7 +27,7 @@ fn ne(&self, other: &cat_type) -> bool { !(*self).eq(other) }
 // ok: T should be in scope when resolving the trait ref for map
 struct cat<T> {
     // Yes, you can have negative meows
-    priv meows : int,
+    meows : int,
 
     how_hungry : int,
     name : T,
@@ -38,11 +38,11 @@ impl<T> cat<T> {
 
     pub fn eat(&mut self) -> bool {
         if self.how_hungry > 0 {
-            error2!("OM NOM NOM");
+            println!("OM NOM NOM");
             self.how_hungry -= 2;
             return true;
         } else {
-            error2!("Not hungry!");
+            println!("Not hungry!");
             return false;
         }
     }
@@ -75,7 +75,7 @@ fn insert(&mut self, k: int, _: T) -> bool {
         true
     }
 
-    fn find_mut<'a>(&'a mut self, _k: &int) -> Option<&'a mut T> { fail2!() }
+    fn find_mut<'a>(&'a mut self, _k: &int) -> Option<&'a mut T> { fail!() }
 
     fn remove(&mut self, k: &int) -> bool {
         if self.find(k).is_some() {
@@ -85,16 +85,16 @@ fn remove(&mut self, k: &int) -> bool {
         }
     }
 
-    fn pop(&mut self, _k: &int) -> Option<T> { fail2!() }
+    fn pop(&mut self, _k: &int) -> Option<T> { fail!() }
 
-    fn swap(&mut self, _k: int, _v: T) -> Option<T> { fail2!() }
+    fn swap(&mut self, _k: int, _v: T) -> Option<T> { fail!() }
 }
 
 impl<T> cat<T> {
     pub fn get<'a>(&'a self, k: &int) -> &'a T {
         match self.find(k) {
           Some(v) => { v }
-          None    => { fail2!("epic fail"); }
+          None    => { fail!("epic fail"); }
         }
     }
 
@@ -106,7 +106,7 @@ pub fn new(in_x: int, in_y: int, in_name: T) -> cat<T> {
 impl<T> cat<T> {
     fn meow(&mut self) {
         self.meows += 1;
-        error2!("Meow {}", self.meows);
+        println!("Meow {}", self.meows);
         if self.meows % 5 == 0 {
             self.how_hungry += 1;
         }
@@ -114,9 +114,9 @@ fn meow(&mut self) {
 }
 
 pub fn main() {
-    let mut nyan: cat<~str> = cat::new(0, 2, ~"nyan");
+    let mut nyan: cat<~str> = cat::new(0, 2, "nyan".to_owned());
     for _ in range(1u, 5) { nyan.speak(); }
-    assert!(*nyan.find(&1).unwrap() == ~"nyan");
+    assert!(*nyan.find(&1).unwrap() == "nyan".to_owned());
     assert_eq!(nyan.find(&10), None);
     let mut spotty: cat<cat_type> = cat::new(2, 57, tuxedo);
     for _ in range(0u, 6) { spotty.speak(); }