mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2026-01-14 01:01:05 +00:00
The main motivation is to move toward running those tests for a specific target, that is, if a test won't run on Windows, then we shouldn't build it. This was previously the default behavior and prevented a successful run on AppVeyor. I borrowed this pattern from the tests in the Cargo project.
52 lines
1 KiB
Rust
52 lines
1 KiB
Rust
use common::util::*;
|
|
|
|
static UTIL_NAME: &'static str = "sort";
|
|
|
|
#[test]
|
|
fn test_numeric_floats_and_ints() {
|
|
test_helper("numeric_floats_and_ints", "-n");
|
|
}
|
|
|
|
#[test]
|
|
fn test_numeric_floats() {
|
|
test_helper("numeric_floats", "-n");
|
|
}
|
|
|
|
#[test]
|
|
fn test_numeric_unfixed_floats() {
|
|
test_helper("numeric_unfixed_floats", "-n");
|
|
}
|
|
|
|
#[test]
|
|
fn test_numeric_fixed_floats() {
|
|
test_helper("numeric_fixed_floats", "-n");
|
|
}
|
|
|
|
#[test]
|
|
fn test_numeric_unsorted_ints() {
|
|
test_helper("numeric_unsorted_ints", "-n");
|
|
}
|
|
|
|
#[test]
|
|
fn test_human_block_sizes() {
|
|
test_helper("human_block_sizes", "-h");
|
|
}
|
|
|
|
#[test]
|
|
fn test_month_default() {
|
|
test_helper("month_default", "-M");
|
|
}
|
|
|
|
#[test]
|
|
fn test_default_unsorted_ints() {
|
|
test_helper("default_unsorted_ints", "");
|
|
}
|
|
|
|
fn test_helper(file_name: &str, args: &str) {
|
|
let (at, mut ucmd) = testing(UTIL_NAME);
|
|
ucmd.arg(args);
|
|
let out = ucmd.arg(format!("{}{}", file_name, ".txt")).run().stdout;
|
|
|
|
let filename = format!("{}{}", file_name, ".expected");
|
|
assert_eq!(out, at.read(&filename));
|
|
}
|