]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/monad.rs
auto merge of #15421 : catharsis/rust/doc-ffi-minor-fixes, r=alexcrichton
[rust.git] / src / test / run-pass / monad.rs
index 8b3cb76817ec41dbf2186dc637111384a9deadac..783dc32426a651f6139d0fa615167766861b684d 100644 (file)
@@ -37,18 +37,18 @@ fn bind<B>(&self, f: |&A| -> Option<B>) -> Option<B> {
     }
 }
 
-fn transform(x: Option<int>) -> Option<StrBuf> {
-    x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str().to_strbuf()) )
+fn transform(x: Option<int>) -> Option<String> {
+    x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_string()) )
 }
 
 pub fn main() {
-    assert_eq!(transform(Some(10)), Some("11".to_strbuf()));
+    assert_eq!(transform(Some(10)), Some("11".to_string()));
     assert_eq!(transform(None), None);
-    assert!((vec!("hi".to_strbuf()))
-        .bind(|x| vec!(x.clone(), format_strbuf!("{}!", x)) )
-        .bind(|x| vec!(x.clone(), format_strbuf!("{}?", x)) ) ==
-        vec!("hi".to_strbuf(),
-             "hi?".to_strbuf(),
-             "hi!".to_strbuf(),
-             "hi!?".to_strbuf()));
+    assert!((vec!("hi".to_string()))
+        .bind(|x| vec!(x.clone(), format!("{}!", x)) )
+        .bind(|x| vec!(x.clone(), format!("{}?", x)) ) ==
+        vec!("hi".to_string(),
+             "hi?".to_string(),
+             "hi!".to_string(),
+             "hi!?".to_string()));
 }