Fix a red test
authorAlex Crichton <alex@alexcrichton.com>
Mon, 23 Jun 2014 16:44:00 +0000 (09:44 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 23 Jun 2014 16:44:00 +0000 (09:44 -0700)
tests/test_shell.rs

index 6a83dd7aa00de39f2300981a1eb0c75178553d8c..908ebaf39699ae2e20497b0e1c7742ba17f4dde9 100644 (file)
@@ -34,12 +34,13 @@ test!(color_explicitly_disabled {
 
 test!(colored_shell {
     let config = ShellConfig { color: true, verbose: true, tty: true };
-    let mut buf: Vec<u8> = Vec::from_elem(22, 0 as u8);
+    let mut buf: Vec<u8> = Vec::from_elem(100, 0 as u8);
 
     Shell::create(writer(buf.as_mut_slice()), config).tap(|shell| {
         shell.say("Hey Alex", color::RED).assert();
-        assert_that(buf.as_slice(), shell_writes(colored_output("Hey Alex\n",
-                                                       color::RED).assert()));
+        let buf = buf.as_slice().slice_to(buf.iter().position(|a| *a == 0).unwrap());
+        assert_that(buf, shell_writes(colored_output("Hey Alex\n",
+                                                     color::RED).assert()));
     });
 })