2015-11-16 05:25:01 +00:00
|
|
|
use common::util::*;
|
|
|
|
|
|
|
|
static UTIL_NAME: &'static str = "echo";
|
2016-07-29 21:26:32 +00:00
|
|
|
fn new_ucmd() -> UCommand {
|
|
|
|
TestScenario::new(UTIL_NAME).ucmd()
|
|
|
|
}
|
2015-11-16 05:25:01 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_default() {
|
2016-07-29 21:26:32 +00:00
|
|
|
assert_eq!(new_ucmd()
|
|
|
|
.run().stdout, "\n");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_no_trailing_newline() {
|
2016-07-29 21:26:32 +00:00
|
|
|
new_ucmd()
|
|
|
|
.arg("-n")
|
|
|
|
.arg("hello_world")
|
|
|
|
.run()
|
|
|
|
.stdout_is("hello_world");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_enable_escapes() {
|
2016-07-29 21:26:32 +00:00
|
|
|
new_ucmd()
|
|
|
|
.arg("-e")
|
|
|
|
.arg("\\\\\\t\\r")
|
|
|
|
.run()
|
|
|
|
.stdout_is("\\\t\r\n");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_disable_escapes() {
|
2016-07-29 21:26:32 +00:00
|
|
|
new_ucmd()
|
|
|
|
.arg("-E")
|
|
|
|
.arg("\\b\\c\\e")
|
|
|
|
.run()
|
|
|
|
.stdout_is("\\b\\c\\e\n");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|