Skip to content

Commit

Permalink
Change the feature test script to actually run the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ogeon committed Apr 22, 2018
1 parent 105fc2c commit 67b9a00
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions palette/examples/color_scheme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn main() {

vec![
primary.shift_hue(shift),
primary.shift_hue((-shift)),
primary.shift_hue(-shift),
]
}
("analogous", matches) => {
Expand All @@ -125,7 +125,7 @@ fn main() {

vec![
primary.shift_hue(shift),
primary.shift_hue((-shift)),
primary.shift_hue(-shift),
]
}
("rectangle", matches) => {
Expand Down
16 changes: 8 additions & 8 deletions palette/src/named.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//!A collection of named color constants. Can be toggled with the `"named"`
//!Cargo feature.
//!A collection of named color constants. Can be toggled with the `"named"` and `"named_from_str"`
//!Cargo features.
//!
//!They are taken from the [SVG keyword
//!colors](https://www.w3.org/TR/SVG/types.html#ColorKeywords) (same as in
Expand All @@ -11,12 +11,12 @@
//!
//!//From constant
//!let from_const = Srgb::<f32>::from_format(named::OLIVE).into_linear();
//!
//!//From name string
//!let olive = named::from_str("olive").expect("unknown color");
//!let from_str = Srgb::<f32>::from_format(olive).into_linear();
//!
//!assert_eq!(from_const, from_str);
#![cfg_attr(feature = "named_from_str", doc = "")]
#![cfg_attr(feature = "named_from_str", doc = "//From name string")]
#![cfg_attr(feature = "named_from_str", doc = "let olive = named::from_str(\"olive\").expect(\"unknown color\");")]
#![cfg_attr(feature = "named_from_str", doc = "let from_str = Srgb::<f32>::from_format(olive).into_linear();")]
#![cfg_attr(feature = "named_from_str", doc = "")]
#![cfg_attr(feature = "named_from_str", doc = "assert_eq!(from_const, from_str);")]
//!```
include!(concat!(env!("OUT_DIR"), "/named.rs"));
Expand Down
8 changes: 4 additions & 4 deletions scripts/test_features.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ done < "Cargo.toml"
echo -e "features: $features\n"

#Test without any optional feature
echo compiling with --no-default-features --features "$required_features"
cargo build --no-default-features --features "$required_features"
echo testing with --no-default-features --features "$required_features"
cargo test --no-default-features --features "$required_features"

#Isolated test of each optional feature
for feature in $features; do
echo compiling with --no-default-features --features "\"$feature $required_features\""
cargo build --no-default-features --features "$feature $required_features"
echo testing with --no-default-features --features "\"$feature $required_features\""
cargo test --no-default-features --features "$feature $required_features"
done

0 comments on commit 67b9a00

Please sign in to comment.