mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Add test for paste.
This commit is contained in:
parent
b00a49eab2
commit
0ea0e7504a
4 changed files with 76 additions and 0 deletions
1
Makefile
1
Makefile
|
@ -164,6 +164,7 @@ TEST_PROGS := \
|
||||||
mkdir \
|
mkdir \
|
||||||
mv \
|
mv \
|
||||||
nl \
|
nl \
|
||||||
|
paste \
|
||||||
seq \
|
seq \
|
||||||
sort \
|
sort \
|
||||||
test \
|
test \
|
||||||
|
|
16
test/fixtures/paste/html_colors.expected
vendored
Normal file
16
test/fixtures/paste/html_colors.expected
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
white #FFFFFF
|
||||||
|
silver #C0C0C0
|
||||||
|
gray #808080
|
||||||
|
black #000000
|
||||||
|
red #FF0000
|
||||||
|
maroon #800000
|
||||||
|
yellow #FFFF00
|
||||||
|
olive #808000
|
||||||
|
lime #00FF00
|
||||||
|
green #008000
|
||||||
|
aqua #00FFFF
|
||||||
|
teal #008080
|
||||||
|
blue #0000FF
|
||||||
|
navy #000080
|
||||||
|
fuchsia #FF00FF
|
||||||
|
purple #800080
|
32
test/fixtures/paste/html_colors.txt
vendored
Normal file
32
test/fixtures/paste/html_colors.txt
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
white
|
||||||
|
#FFFFFF
|
||||||
|
silver
|
||||||
|
#C0C0C0
|
||||||
|
gray
|
||||||
|
#808080
|
||||||
|
black
|
||||||
|
#000000
|
||||||
|
red
|
||||||
|
#FF0000
|
||||||
|
maroon
|
||||||
|
#800000
|
||||||
|
yellow
|
||||||
|
#FFFF00
|
||||||
|
olive
|
||||||
|
#808000
|
||||||
|
lime
|
||||||
|
#00FF00
|
||||||
|
green
|
||||||
|
#008000
|
||||||
|
aqua
|
||||||
|
#00FFFF
|
||||||
|
teal
|
||||||
|
#008080
|
||||||
|
blue
|
||||||
|
#0000FF
|
||||||
|
navy
|
||||||
|
#000080
|
||||||
|
fuchsia
|
||||||
|
#FF00FF
|
||||||
|
purple
|
||||||
|
#800080
|
27
test/paste.rs
Normal file
27
test/paste.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Read;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
static PROGNAME: &'static str = "./paste";
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_combine_pairs_of_lines() {
|
||||||
|
let po = Command::new(PROGNAME)
|
||||||
|
.arg("-s")
|
||||||
|
.arg("-d")
|
||||||
|
.arg("\t\n")
|
||||||
|
.arg("html_colors.txt")
|
||||||
|
.output()
|
||||||
|
.unwrap_or_else(|err| panic!("{}", err));
|
||||||
|
|
||||||
|
let mut f = File::open(Path::new("html_colors.expected")).unwrap_or_else(|err| {
|
||||||
|
panic!("{}", err)
|
||||||
|
});
|
||||||
|
let mut expected = vec!();
|
||||||
|
match f.read_to_end(&mut expected) {
|
||||||
|
Ok(_) => {},
|
||||||
|
Err(err) => panic!("{}", err)
|
||||||
|
}
|
||||||
|
assert_eq!(String::from_utf8(po.stdout).unwrap(), String::from_utf8(expected).unwrap());
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue