1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

allow feature-gated integration tests for unimplemented functionality

This commit is contained in:
Nathan Ross 2016-02-15 18:08:37 -05:00
parent 67de2ca9f7
commit e32efaa5a1
5 changed files with 27 additions and 2 deletions

View file

@ -87,6 +87,7 @@ generic = [
"yes",
]
default = ["generic", "unix"]
test_unimplemented = []
[dependencies]
uucore = { path="src/uucore" }

View file

@ -177,6 +177,13 @@ TEST_PROGS := \
TESTS := \
$(sort $(filter $(UTILS),$(filter-out $(SKIP_UTILS),$(TEST_PROGS))))
TEST_NO_FAIL_FAST :=
TEST_SPEC_FEATURE :=
ifneq ($(SPEC),)
TEST_NO_FAIL_FAST :=--no-fail-fast
TEST_SPEC_FEATURE := test_unimplemented
endif
define BUILD_EXE
build_exe_$(1):
${CARGO} build ${CARGOFLAGS} ${PROFILE_CMD} -p $(1)
@ -184,7 +191,7 @@ endef
define TEST_INTEGRATION
test_integration_$(1): build_exe_$(1)
${CARGO} test ${CARGOFLAGS} --test $(1) --features $(1) --no-default-features
${CARGO} test ${CARGOFLAGS} --test $(1) --features "$(1) $(TEST_SPEC_FEATURE)" --no-default-features $(TEST_NO_FAIL_FAST)
endef
define TEST_BUSYBOX

View file

@ -116,6 +116,11 @@ To test only a few of the available utilities:
make UTILS='UTILITY_1 UTILITY_2' test
```
To include tests for unimplemented behavior:
```
make UTILS='UTILITY_1 UTILITY_2' SPEC=y test
```
Run busybox tests
-----------------

View file

@ -12,7 +12,7 @@ pub fn main() {
if val == "1" && key.starts_with(feature_prefix) {
let krate = key[feature_prefix.len()..].to_lowercase();
match krate.as_ref() {
"default" | "unix" | "generic" => continue,
"default" | "unix" | "generic" | "test_unimplemented" => continue,
_ => {},
}
crates.push(krate.to_string());

View file

@ -188,6 +188,18 @@ fn sub_num_dec_trunc() {
expect_stdout(vec!["pi is ~ %g", "3.1415926535"], "pi is ~ 3.141593");
}
#[cfg_attr(not(feature="test_unimplemented"),ignore)]
#[test]
fn sub_num_hex_float_lower() {
expect_stdout(vec!["%a", ".875"], "0xep-4");
}
#[cfg_attr(not(feature="test_unimplemented"),ignore)]
#[test]
fn sub_num_hex_float_upper() {
expect_stdout(vec!["%A", ".875"], "0XEP-4");
}
#[test]
fn sub_minwidth() {
expect_stdout(vec!["hello %7s", "world"], "hello world");