mirror of
https://github.com/uutils/coreutils
synced 2024-12-20 01:54:15 +00:00
569cd162d3
Updates to individual integration tests - use proposed conventional approach to beginning tests - use new convenience functions for using fixtures - use new names for TestScenario Updates to integration test modules - add proposed conventional module-level functions Updates to test/common/util.rs - rename TestSet, and its methods, for semantic clarity - create convenience functions for use of fixtures - delete convenience functions obsoleted by new conventions
72 lines
2 KiB
Rust
72 lines
2 KiB
Rust
use common::util::*;
|
|
|
|
static UTIL_NAME: &'static str = "pinky";
|
|
fn new_ucmd() -> UCommand {
|
|
TestScenario::new(UTIL_NAME).ucmd()
|
|
}
|
|
|
|
extern crate uu_pinky;
|
|
pub use self::uu_pinky::*;
|
|
|
|
#[test]
|
|
fn test_capitalize() {
|
|
assert_eq!("Zbnmasd", "zbnmasd".capitalize());
|
|
assert_eq!("Abnmasd", "Abnmasd".capitalize());
|
|
assert_eq!("1masd", "1masd".capitalize());
|
|
assert_eq!("", "".capitalize());
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(target_os = "linux")]
|
|
fn test_long_format() {
|
|
new_ucmd()
|
|
.arg("-l").arg("root")
|
|
.run()
|
|
.stdout_is("Login name: root In real life: root\nDirectory: /root Shell: /bin/bash\n\n");
|
|
|
|
new_ucmd()
|
|
.arg("-lb").arg("root")
|
|
.run()
|
|
.stdout_is("Login name: root In real life: root\n\n");
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(target_os = "macos")]
|
|
fn test_long_format() {
|
|
new_ucmd()
|
|
.arg("-l").arg("root")
|
|
.run()
|
|
.stdout_is("Login name: root In real life: System Administrator\nDirectory: /var/root Shell: /bin/sh\n\n");
|
|
|
|
new_ucmd()
|
|
.arg("-lb").arg("root")
|
|
.run()
|
|
.stdout_is("Login name: root In real life: System Administrator\n\n");
|
|
}
|
|
|
|
#[cfg(target_os = "linux")]
|
|
#[test]
|
|
#[ignore]
|
|
fn test_short_format() {
|
|
let scene = TestScenario::new(UTIL_NAME);
|
|
|
|
let args = ["-s"];
|
|
scene.ucmd().args(&args).run().stdout_is(expected_result(&args));
|
|
|
|
let args = ["-f"];
|
|
scene.ucmd().args(&args).run().stdout_is(expected_result(&args));
|
|
|
|
let args = ["-w"];
|
|
scene.ucmd().args(&args).run().stdout_is(expected_result(&args));
|
|
|
|
let args = ["-i"];
|
|
scene.ucmd().args(&args).run().stdout_is(expected_result(&args));
|
|
|
|
let args = ["-q"];
|
|
scene.ucmd().args(&args).run().stdout_is(expected_result(&args));
|
|
}
|
|
|
|
#[cfg(target_os = "linux")]
|
|
fn expected_result(args: &[&str]) -> String {
|
|
TestScenario::new(UTIL_NAME).cmd(UTIL_NAME).args(args).run().stdout
|
|
}
|