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:
parent
67de2ca9f7
commit
e32efaa5a1
5 changed files with 27 additions and 2 deletions
|
@ -87,6 +87,7 @@ generic = [
|
||||||
"yes",
|
"yes",
|
||||||
]
|
]
|
||||||
default = ["generic", "unix"]
|
default = ["generic", "unix"]
|
||||||
|
test_unimplemented = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
uucore = { path="src/uucore" }
|
uucore = { path="src/uucore" }
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -177,6 +177,13 @@ TEST_PROGS := \
|
||||||
TESTS := \
|
TESTS := \
|
||||||
$(sort $(filter $(UTILS),$(filter-out $(SKIP_UTILS),$(TEST_PROGS))))
|
$(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
|
define BUILD_EXE
|
||||||
build_exe_$(1):
|
build_exe_$(1):
|
||||||
${CARGO} build ${CARGOFLAGS} ${PROFILE_CMD} -p $(1)
|
${CARGO} build ${CARGOFLAGS} ${PROFILE_CMD} -p $(1)
|
||||||
|
@ -184,7 +191,7 @@ endef
|
||||||
|
|
||||||
define TEST_INTEGRATION
|
define TEST_INTEGRATION
|
||||||
test_integration_$(1): build_exe_$(1)
|
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
|
endef
|
||||||
|
|
||||||
define TEST_BUSYBOX
|
define TEST_BUSYBOX
|
||||||
|
|
|
@ -116,6 +116,11 @@ To test only a few of the available utilities:
|
||||||
make UTILS='UTILITY_1 UTILITY_2' test
|
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
|
Run busybox tests
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|
2
build.rs
2
build.rs
|
@ -12,7 +12,7 @@ pub fn main() {
|
||||||
if val == "1" && key.starts_with(feature_prefix) {
|
if val == "1" && key.starts_with(feature_prefix) {
|
||||||
let krate = key[feature_prefix.len()..].to_lowercase();
|
let krate = key[feature_prefix.len()..].to_lowercase();
|
||||||
match krate.as_ref() {
|
match krate.as_ref() {
|
||||||
"default" | "unix" | "generic" => continue,
|
"default" | "unix" | "generic" | "test_unimplemented" => continue,
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
crates.push(krate.to_string());
|
crates.push(krate.to_string());
|
||||||
|
|
|
@ -188,6 +188,18 @@ fn sub_num_dec_trunc() {
|
||||||
expect_stdout(vec!["pi is ~ %g", "3.1415926535"], "pi is ~ 3.141593");
|
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]
|
#[test]
|
||||||
fn sub_minwidth() {
|
fn sub_minwidth() {
|
||||||
expect_stdout(vec!["hello %7s", "world"], "hello world");
|
expect_stdout(vec!["hello %7s", "world"], "hello world");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue