2020-05-25 17:05:26 +00:00
|
|
|
use crate::common::util::*;
|
2015-11-16 05:25:01 +00:00
|
|
|
|
|
|
|
static INPUT: &'static str = "lorem_ipsum.txt";
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_stdin_default() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!()
|
2016-07-29 21:26:32 +00:00
|
|
|
.pipe_in_fixture(INPUT)
|
2020-04-13 18:36:03 +00:00
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_default.expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_stdin_1_line_obsolete() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!()
|
2016-07-29 21:26:32 +00:00
|
|
|
.args(&["-1"])
|
|
|
|
.pipe_in_fixture(INPUT)
|
2020-04-13 18:36:03 +00:00
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_1_line.expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_stdin_1_line() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!()
|
2016-07-29 21:26:32 +00:00
|
|
|
.args(&["-n", "1"])
|
|
|
|
.pipe_in_fixture(INPUT)
|
2020-04-13 18:36:03 +00:00
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_1_line.expected");
|
2020-05-10 19:31:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_stdin_negative_23_line() {
|
|
|
|
new_ucmd!()
|
|
|
|
.args(&["-n", "-23"])
|
|
|
|
.pipe_in_fixture(INPUT)
|
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_1_line.expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_stdin_5_chars() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!()
|
2016-07-29 21:26:32 +00:00
|
|
|
.args(&["-c", "5"])
|
|
|
|
.pipe_in_fixture(INPUT)
|
2020-04-13 18:36:03 +00:00
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_5_chars.expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_single_default() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!()
|
2016-07-29 21:26:32 +00:00
|
|
|
.arg(INPUT)
|
2020-04-13 18:36:03 +00:00
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_default.expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_single_1_line_obsolete() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!()
|
2016-07-29 21:26:32 +00:00
|
|
|
.args(&["-1", INPUT])
|
2020-04-13 18:36:03 +00:00
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_1_line.expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_single_1_line() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!()
|
2016-07-29 21:26:32 +00:00
|
|
|
.args(&["-n", "1", INPUT])
|
2020-04-13 18:36:03 +00:00
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_1_line.expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_single_5_chars() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!()
|
2016-07-29 21:26:32 +00:00
|
|
|
.args(&["-c", "5", INPUT])
|
2020-04-13 18:36:03 +00:00
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_5_chars.expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_verbose() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!()
|
2016-07-29 21:26:32 +00:00
|
|
|
.args(&["-v", INPUT])
|
2020-04-13 18:36:03 +00:00
|
|
|
.run()
|
|
|
|
.stdout_is_fixture("lorem_ipsum_verbose.expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|