Test all contrib features individually.

This commit is contained in:
Sergio Benitez 2018-08-18 16:52:45 -07:00
parent 9966a07c58
commit 58519e495e
6 changed files with 46 additions and 10 deletions

View File

@ -5,6 +5,7 @@ cache: cargo
env:
- TEST_FLAGS=
- TEST_FLAGS=--release
- TEST_FLAGS=--contrib
rust:
- nightly
script: ./scripts/test.sh $TEST_FLAGS

View File

@ -1,3 +1,4 @@
#![doc(cfg(feature = "diesel_sqlite_pool"))]
//! Traits, utilities, and a macro for easy database connection pooling.
//!
//! # Overview

View File

@ -1,6 +1,7 @@
#![feature(use_extern_macros)]
#![feature(crate_visibility_modifier)]
#![feature(never_type)]
#![feature(doc_cfg)]
// TODO: Version URLs.
#![doc(html_root_url = "https://api.rocket.rs")]

View File

@ -13,6 +13,7 @@ pub trait Engine: Send + Sync + 'static {
fn render<C: Serialize>(&self, name: &str, context: C) -> Option<String>;
}
#[doc(cfg(feature = "tera_templates"))]
/// A structure exposing access to templating engines.
///
/// Calling methods on the exposed template engine types may require importing

View File

@ -9,8 +9,8 @@ use super::ContextManager;
///
/// # Usage
///
/// First, ensure that the template [fairing](`rocket::fairing`) is attached to
/// your Rocket application:
/// First, ensure that the template [fairing](`rocket::fairing`),
/// [`Template::fairing()`] is attached to your Rocket application:
///
/// ```rust
/// # extern crate rocket;
@ -26,8 +26,8 @@ use super::ContextManager;
/// }
/// ```
///
/// The `TemplateMetadata` type implements Rocket's `FromRequest` trait, so it can
/// be used as a request guard in any request handler.
/// The `TemplateMetadata` type implements Rocket's `FromRequest` trait, so it
/// can be used as a request guard in any request handler.
///
/// ```rust
/// # #![feature(plugin, decl_macro)]
@ -40,11 +40,13 @@ use super::ContextManager;
///
/// #[get("/")]
/// fn homepage(metadata: TemplateMetadata) -> Template {
/// # use std::collections::HashMap;
/// # let context: HashMap<String, String> = HashMap::new();
/// // Conditionally render a template if it's available.
/// if metadata.contains_template("some-template") {
/// Template::render("some-template", json!({ /* .. */ }))
/// Template::render("some-template", &context)
/// } else {
/// Template::render("fallback", json!({ /* .. */ }))
/// Template::render("fallback", &context)
/// }
/// }
/// ```

View File

@ -79,8 +79,38 @@ ensure_trailing_whitespace_free
echo ":: Updating dependencies..."
cargo update
if [ "$1" = "--contrib" ]; then
FEATURES=(
json
msgpack
tera_templates
handlebars_templates
static_files
diesel_postgres_pool
diesel_sqlite_pool
diesel_mysql_pool
postgres_pool
mysql_pool
sqlite_pool
cypher_pool
redis_pool
)
pushd "${CONTRIB_LIB_ROOT}" > /dev/null 2>&1
echo ":: Building and testing contrib [default]..."
CARGO_INCREMENTAL=0 cargo test
for feature in "${FEATURES[@]}"; do
echo ":: Building and testing contrib [${feature}]..."
CARGO_INCREMENTAL=0 cargo test --no-default-features --features "${feature}"
done
popd > /dev/null 2>&1
else
echo ":: Bootstrapping examples..."
bootstrap_examples
echo ":: Building and testing libraries..."
CARGO_INCREMENTAL=0 cargo test --all-features --all $@
fi