Config Travis
This commit is contained in:
parent
8794ca46be
commit
01c2437f24
20
.travis.yml
20
.travis.yml
|
@ -1,4 +1,6 @@
|
|||
language: rust
|
||||
sudo: required
|
||||
cache: cargo
|
||||
rust:
|
||||
- stable
|
||||
- beta
|
||||
|
@ -16,4 +18,20 @@ matrix:
|
|||
allow_failures:
|
||||
- rust: nightly
|
||||
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
|
||||
|
|
22
src/lib.rs
22
src/lib.rs
|
@ -44,6 +44,19 @@
|
|||
//! 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
|
||||
|
||||
|
@ -80,6 +93,15 @@ mod tests {
|
|||
#[test]
|
||||
fn it_translates() {
|
||||
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]
|
||||
#[should_panic]
|
||||
|
|
Loading…
Reference in New Issue