Config Travis

This commit is contained in:
Terry Raimondo 2019-10-09 03:20:39 +02:00
parent 8794ca46be
commit 01c2437f24
2 changed files with 41 additions and 1 deletions

View File

@ -1,4 +1,6 @@
language: rust language: rust
sudo: required
cache: cargo
rust: rust:
- stable - stable
- beta - beta
@ -16,4 +18,20 @@ matrix:
allow_failures: allow_failures:
- rust: nightly - rust: nightly
fast_finish: true fast_finish: true
cache: cargo addons:
apt:
packages:
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
- binutils-dev
- cmake
sources:
- kalakris-cmake
cache:
directories:
- /home/travis/.cargo
before_cache:
- rm -rf /home/travis/.cargo/registry

View File

@ -44,6 +44,19 @@
//! assert_eq!("You are not allowed to do this", res); //! assert_eq!("You are not allowed to do this", res);
//! } //! }
//! ``` //! ```
//!
//! If the key is missing, your code will not compile
//! ```rust,compile_fail
//! use internationalization::t;
//!
//! fn main() {
//! let lang = "en";
//! let res = t!("missing key", lang);
//! // Code will not compile
//! }
//! ```
//! ## Installation //! ## Installation
@ -80,6 +93,15 @@ mod tests {
#[test] #[test]
fn it_translates() { fn it_translates() {
assert_eq!(t!("key.test", "en"), "This is a test"); assert_eq!(t!("key.test", "en"), "This is a test");
assert_eq!(t!("key.test", "fr"), "C'est un test");
assert_eq!(
t!("err.not_allowed", "fr"),
"Vous n'êtes pas autorisé à faire cela"
);
assert_eq!(
t!("err.not_allowed", "en"),
"You are not allowed to do this"
);
} }
#[test] #[test]
#[should_panic] #[should_panic]