Merge pull request #287 from ebfe/remove-bytes

Remove use of bytes!()
This commit is contained in:
Oly Mi 2014-06-20 18:32:20 +04:00
commit 0b3c6552ef
4 changed files with 10 additions and 10 deletions

View file

@ -22,7 +22,7 @@ fn test_output_multi_files_print_all_chars() {
fn test_stdin_squeeze() {
let mut process= Command::new("build/cat").arg("-A").spawn().unwrap();
process.stdin.take_unwrap().write(bytes!("\x00\x01\x02")).unwrap();
process.stdin.take_unwrap().write(b"\x00\x01\x02").unwrap();
let po = process.wait_with_output().unwrap();
let out = str::from_utf8(po.output.as_slice()).unwrap();
@ -33,7 +33,7 @@ fn test_stdin_squeeze() {
fn test_stdin_number_non_blank() {
let mut process = Command::new("build/cat").arg("-b").arg("-").spawn().unwrap();
process.stdin.take_unwrap().write(bytes!("\na\nb\n\n\nc")).unwrap();
process.stdin.take_unwrap().write(b"\na\nb\n\n\nc").unwrap();
let po = process.wait_with_output().unwrap();
let out = str::from_utf8(po.output.as_slice()).unwrap();

View file

@ -5,7 +5,7 @@ use std::str;
fn test_stdin_nonewline() {
let mut process = Command::new("build/nl").spawn().unwrap();
process.stdin.take_unwrap().write(bytes!("No Newline")).unwrap();
process.stdin.take_unwrap().write(b"No Newline").unwrap();
let po = process.wait_with_output().unwrap();
let out = str::from_utf8(po.output.as_slice()).unwrap();
@ -17,7 +17,7 @@ fn test_stdin_newline() {
let mut process = Command::new("build/nl").arg("-s").arg("-")
.arg("-w").arg("1").spawn().unwrap();
process.stdin.take_unwrap().write(bytes!("Line One\nLine Two\n")).unwrap();
process.stdin.take_unwrap().write(b"Line One\nLine Two\n").unwrap();
let po = process.wait_with_output().unwrap();
let out = str::from_utf8(po.output.as_slice()).unwrap();

View file

@ -15,31 +15,31 @@ fn run(input: &str, args: &[&'static str]) -> Vec<u8> {
#[test]
fn test_toupper() {
let out = run("!abcd!", ["a-z", "A-Z"]);
assert_eq!(out.as_slice(), bytes!("!ABCD!"));
assert_eq!(out.as_slice(), b"!ABCD!");
}
#[test]
fn test_small_set2() {
let out = run("@0123456789", ["0-9", "X"]);
assert_eq!(out.as_slice(), bytes!("@XXXXXXXXXX"));
assert_eq!(out.as_slice(), b"@XXXXXXXXXX");
}
#[test]
fn test_unicode() {
let out = run("(,°□°), ┬─┬", [", ┬─┬", "╯︵┻━┻"]);
assert_eq!(out.as_slice(), bytes!("(╯°□°)╯︵┻━┻"));
assert_eq!(out.as_slice(), "(╯°□°)╯︵┻━┻".as_bytes());
}
#[test]
fn test_delete() {
let out = run("aBcD", ["-d", "a-z"]);
assert_eq!(out.as_slice(), bytes!("BD"));
assert_eq!(out.as_slice(), b"BD");
}
#[test]
fn test_delete_complement() {
let out = run("aBcD", ["-d", "-c", "a-z"]);
assert_eq!(out.as_slice(), bytes!("ac"));
assert_eq!(out.as_slice(), b"ac");
}

View file

@ -28,7 +28,7 @@ fn test_increase_file_size() {
#[test]
fn test_decrease_file_size() {
let mut file = make_file(TFILE2);
file.write(bytes!("1234567890")).unwrap();
file.write(b"1234567890").unwrap();
if !Command::new(PROG).args(["--size=-4", TFILE2]).status().unwrap().success() {
fail!();
}