Browse Source

Move tests to `/tests` directory

master
Andreas Linz 5 years ago
parent
commit
f067503e65
4 changed files with 62 additions and 53 deletions
  1. +0
    -53
      src/lib.rs
  2. +23
    -0
      tests/test_circle.rs
  3. +15
    -0
      tests/test_no_ci.rs
  4. +24
    -0
      tests/test_travis.rs

+ 0
- 53
src/lib.rs View File

@ -160,56 +160,3 @@ impl Ci {
lang_version!("RUST", rust);
lang_version!("SCALA", scala);
}
#[test]
fn test_unknown() {
assert!(Ci::lang().is_some());
assert!(Ci::path().is_some());
assert!(Ci::home().is_some());
let ci = Ci::new();
if ci.is_some() {
return;
}
assert_eq!(Ci::which_ci(), CiService::Unknown);
}
#[test]
fn test_travis() {
assert!(Ci::lang().is_some());
assert!(Ci::path().is_some());
assert!(Ci::home().is_some());
let ci = match Ci::new() {
None => return,
Some(ci) => {
if ci.is_travis() {
ci
} else {
return;
}
}
};
assert!(ci.is_travis());
assert!(ci.rust().is_some());
assert!(ci.commit().is_some());
assert!(ci.build_dir().is_some());
}
#[test]
fn test_circle() {
assert!(Ci::lang().is_some());
assert!(Ci::path().is_some());
assert!(Ci::home().is_some());
let ci = match Ci::new() {
None => return,
Some(ci) => {
if ci.is_circle() {
ci
} else {
return;
}
}
};
assert!(ci.is_circle());
assert!(ci.commit().is_some());
assert!(ci.build_url().is_some());
}

+ 23
- 0
tests/test_circle.rs View File

@ -0,0 +1,23 @@
extern crate rci;
use rci::*;
#[test]
fn test_circle() {
assert!(Ci::lang().is_some());
assert!(Ci::path().is_some());
assert!(Ci::home().is_some());
let ci = match Ci::new() {
None => return,
Some(ci) => {
if ci.is_circle() {
ci
} else {
return;
}
}
};
assert!(ci.is_circle());
assert!(ci.commit().is_some());
assert!(ci.build_url().is_some());
}

+ 15
- 0
tests/test_no_ci.rs View File

@ -0,0 +1,15 @@
extern crate rci;
use rci::*;
#[test]
fn test_unknown() {
assert!(Ci::lang().is_some());
assert!(Ci::path().is_some());
assert!(Ci::home().is_some());
let ci = Ci::new();
if ci.is_some() {
return;
}
assert_eq!(Ci::which_ci(), CiService::Unknown);
}

+ 24
- 0
tests/test_travis.rs View File

@ -0,0 +1,24 @@
extern crate rci;
use rci::*;
#[test]
fn test_travis() {
assert!(Ci::lang().is_some());
assert!(Ci::path().is_some());
assert!(Ci::home().is_some());
let ci = match Ci::new() {
None => return,
Some(ci) => {
if ci.is_travis() {
ci
} else {
return;
}
}
};
assert!(ci.is_travis());
assert!(ci.rust().is_some());
assert!(ci.commit().is_some());
assert!(ci.build_dir().is_some());
}

Loading…
Cancel
Save