@@ -4,13 +4,15 @@ set -ex
44
55echo Testing num on rustc ${TRAVIS_RUST_VERSION}
66
7- FEATURES=" serde"
8- if [[ " $TRAVIS_RUST_VERSION " =~ ^(nightly| beta| stable| 1.26.0| 1.22.0)$ ]]; then
9- FEATURES=" $FEATURES rand"
10- fi
11- if [[ " $TRAVIS_RUST_VERSION " =~ ^(nightly| beta| stable| 1.26.0)$ ]]; then
12- FEATURES=" $FEATURES i128"
13- fi
7+ case " $TRAVIS_RUST_VERSION " in
8+ 1.31.* ) STD_FEATURES=" serde" ;;
9+ * ) STD_FEATURES=" serde rand" ;;
10+ esac
11+
12+ case " $TRAVIS_RUST_VERSION " in
13+ 1.3[1-5].* ) ;;
14+ * ) ALLOC_FEATURES=" serde rand" ;;
15+ esac
1416
1517# num should build and test everywhere.
1618cargo build --verbose
@@ -22,11 +24,27 @@ cargo test --no-default-features
2224
2325# Each isolated feature should also work everywhere.
2426# (but still with "std", else bigint breaks)
25- for feature in $FEATURES ; do
27+ for feature in $STD_FEATURES ; do
2628 cargo build --verbose --no-default-features --features=" std $feature "
2729 cargo test --verbose --no-default-features --features=" std $feature "
2830done
2931
3032# test all supported features together
31- cargo build --features=" std $FEATURES "
32- cargo test --features=" std $FEATURES "
33+ cargo build --features=" std $STD_FEATURES "
34+ cargo test --features=" std $STD_FEATURES "
35+
36+ if test -n " ${ALLOC_FEATURES: +true} " ; then
37+ # It should build with minimal features too.
38+ cargo build --no-default-features --features=" alloc"
39+ cargo test --no-default-features --features=" alloc"
40+
41+ # Each isolated feature should also work everywhere.
42+ for feature in $ALLOC_FEATURES ; do
43+ cargo build --verbose --no-default-features --features=" alloc $feature "
44+ cargo test --verbose --no-default-features --features=" alloc $feature "
45+ done
46+
47+ # test all supported features together
48+ cargo build --no-default-features --features=" alloc $ALLOC_FEATURES "
49+ cargo test --no-default-features --features=" alloc $ALLOC_FEATURES "
50+ fi
0 commit comments