mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 14:07:46 +00:00
Fix failing test for sort.
The sorted values were not outputted using a newline.
This commit is contained in:
parent
5bdd303d68
commit
b809af601a
2 changed files with 13 additions and 13 deletions
|
@ -152,7 +152,7 @@ fn frac_compare(a: &String, b: &String) -> Ordering {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn print_sorted<S, T: Iterator<Item=S>>(iter: T) where S: std::fmt::Display {
|
fn print_sorted<S, T: Iterator<Item=S>>(iter: T) where S: std::fmt::Display {
|
||||||
for line in iter {
|
for line in iter {
|
||||||
print!("{}", line);
|
println!("{}", line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
24
test/sort.rs
24
test/sort.rs
|
@ -1,8 +1,7 @@
|
||||||
#![allow(unstable)]
|
use std::fs::File;
|
||||||
|
use std::io::Read;
|
||||||
use std::old_io::process::Command;
|
use std::path::Path;
|
||||||
use std::old_io::File;
|
use std::process::Command;
|
||||||
use std::string::String;
|
|
||||||
|
|
||||||
static PROGNAME: &'static str = "./sort";
|
static PROGNAME: &'static str = "./sort";
|
||||||
|
|
||||||
|
@ -34,15 +33,16 @@ fn numeric5() {
|
||||||
fn numeric_helper(test_num: isize) {
|
fn numeric_helper(test_num: isize) {
|
||||||
let mut cmd = Command::new(PROGNAME);
|
let mut cmd = Command::new(PROGNAME);
|
||||||
cmd.arg("-n");
|
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,
|
Ok(p) => p,
|
||||||
Err(err) => panic!("{}", err),
|
Err(err) => panic!("{}", err),
|
||||||
};
|
};
|
||||||
|
|
||||||
let answer = match File::open(&Path::new(format!("{}{}{}", "numeric", test_num, ".ans")))
|
let filename = format!("{}{}{}", "numeric", test_num, ".ans");
|
||||||
.read_to_end() {
|
let mut f = File::open(Path::new(&filename)).unwrap_or_else(|err| {
|
||||||
Ok(answer) => answer,
|
panic!("{}", err)
|
||||||
Err(err) => panic!("{}", err),
|
});
|
||||||
};
|
let mut answer = vec!();
|
||||||
assert_eq!(String::from_utf8(po.output).unwrap(), String::from_utf8(answer).unwrap());
|
let _ = f.read_to_end(&mut answer);
|
||||||
|
assert_eq!(String::from_utf8(po.stdout).unwrap(), String::from_utf8(answer).unwrap());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue