mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #570 from jbcrail/fix-sort-test
Fix failing test for sort.
This commit is contained in:
+1
-1
@@ -152,7 +152,7 @@ fn frac_compare(a: &String, b: &String) -> Ordering {
|
||||
#[inline(always)]
|
||||
fn print_sorted<S, T: Iterator<Item=S>>(iter: T) where S: std::fmt::Display {
|
||||
for line in iter {
|
||||
print!("{}", line);
|
||||
println!("{}", line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-13
@@ -1,8 +1,7 @@
|
||||
#![allow(unstable)]
|
||||
|
||||
use std::old_io::process::Command;
|
||||
use std::old_io::File;
|
||||
use std::string::String;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
static PROGNAME: &'static str = "./sort";
|
||||
|
||||
@@ -34,15 +33,19 @@ fn numeric5() {
|
||||
fn numeric_helper(test_num: isize) {
|
||||
let mut cmd = Command::new(PROGNAME);
|
||||
cmd.arg("-n");
|
||||
let po = match cmd.clone().arg(format!("{}{}{}", "numeric", test_num, ".txt")).output() {
|
||||
let po = match cmd.arg(format!("{}{}{}", "numeric", test_num, ".txt")).output() {
|
||||
Ok(p) => p,
|
||||
Err(err) => panic!("{}", err),
|
||||
Err(err) => panic!("{}", err)
|
||||
};
|
||||
|
||||
let answer = match File::open(&Path::new(format!("{}{}{}", "numeric", test_num, ".ans")))
|
||||
.read_to_end() {
|
||||
Ok(answer) => answer,
|
||||
Err(err) => panic!("{}", err),
|
||||
};
|
||||
assert_eq!(String::from_utf8(po.output).unwrap(), String::from_utf8(answer).unwrap());
|
||||
let filename = format!("{}{}{}", "numeric", test_num, ".ans");
|
||||
let mut f = File::open(Path::new(&filename)).unwrap_or_else(|err| {
|
||||
panic!("{}", err)
|
||||
});
|
||||
let mut answer = vec!();
|
||||
match f.read_to_end(&mut answer) {
|
||||
Ok(_) => {},
|
||||
Err(err) => panic!("{}", err)
|
||||
}
|
||||
assert_eq!(String::from_utf8(po.stdout).unwrap(), String::from_utf8(answer).unwrap());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user