diff options
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | testing/Cargo.toml | 19 | ||||
-rw-r--r-- | testing/tests/filters.rs | 4 | ||||
-rw-r--r-- | testing/tests/iron.rs | 1 |
4 files changed, 18 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index f796f61..2e1e8ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ before_script: script: - cargo test --all - if [[ "${TRAVIS_RUST_VERSION}" == stable ]]; then + cd testing && cargo test --features full; cargo fmt -- --check; fi - if [[ "${TRAVIS_RUST_VERSION}" == nightly ]]; then diff --git a/testing/Cargo.toml b/testing/Cargo.toml index 7c93783..15cbfe2 100644 --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -5,22 +5,27 @@ authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"] workspace = ".." [features] -default = ["actix"] -with-rocket = ["rocket", "rocket_codegen", "askama/with-rocket"] actix = ["actix-web", "bytes", "askama/with-actix-web"] +default = [] +full = ["actix", "with-iron", "serde-json"] +serde-json = ["serde_json", "askama/serde-json"] +with-rocket = ["rocket", "rocket_codegen", "askama/with-rocket"] +with-iron = ["iron", "askama/with-iron"] [dependencies] actix-web = { version = "0.7", optional = true } -askama = { path = "../askama", version = "*", features = ["with-iron", "serde-json"] } +askama = { path = "../askama", version = "*" } bytes = { version = "0.4", optional = true } -criterion = "0.2" -iron = "0.6" +iron = { version = "0.6", optional = true } rocket = { version = "0.3", optional = true } rocket_codegen = { version = "0.3", optional = true } -serde_json = "1.0" +serde_json = { version = "1.0", optional = true } [build-dependencies] -askama = { path = "../askama", version = "*", features = ["with-iron", "serde-json"] } +askama = { path = "../askama", version = "*" } + +[dev-dependencies] +criterion = "0.2" [[bench]] name = "all" diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs index 8c654c1..d6e9782 100644 --- a/testing/tests/filters.rs +++ b/testing/tests/filters.rs @@ -1,9 +1,11 @@ #[macro_use] extern crate askama; +#[cfg(feature = "serde-json")] #[macro_use] extern crate serde_json; use askama::Template; +#[cfg(feature = "serde-json")] use serde_json::Value; #[derive(Template)] @@ -87,6 +89,7 @@ fn test_vec_join() { assert_eq!(t.render().unwrap(), "foo, bar, bazz"); } +#[cfg(feature = "serde-json")] #[derive(Template)] #[template(path = "json.html")] struct JsonTemplate<'a> { @@ -94,6 +97,7 @@ struct JsonTemplate<'a> { bar: &'a Value, } +#[cfg(feature = "serde-json")] #[test] fn test_json() { let val = json!({"arr": [ "one", 2, true, null ]}); diff --git a/testing/tests/iron.rs b/testing/tests/iron.rs index 95c366c..10dcee3 100644 --- a/testing/tests/iron.rs +++ b/testing/tests/iron.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "iron")] #[macro_use] extern crate askama; extern crate iron; |