Auto merge of #30 - matthiasbeyer:add-travis-homu, r=matthiasbeyer

Add travis, Homu

Implementing #26 , #27
This commit is contained in:
Homu 2015-12-29 23:13:41 +09:00
commit 568026c52c
4 changed files with 63 additions and 17 deletions

41
.travis.yml Normal file
View file

@ -0,0 +1,41 @@
sudo: false
language: rust
rust:
- beta
- nightly
- stable
matrix:
allow_failures:
- rust: nightly
before_script:
- |
pip install 'travis-cargo<0.2' --user &&
export PATH=$HOME/.local/bin:$PATH
script:
- |
travis-cargo build &&
travis-cargo test &&
travis-cargo bench &&
travis-cargo --only stable doc
addons:
apt:
packages:
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
after_success:
- travis-cargo --only stable doc-upload
- travis-cargo coveralls --no-sudo
notifications:
email:
on_success: never
env:
global:
- TRAVIS_CARGO_NIGHTLY_FEATURE=dev

View file

@ -113,7 +113,8 @@ impl Into<String> for FileID {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::{FileID, FileIDType}; use storage::file::id::FileID;
use storage::file::id_type::FileIDType;
#[test] #[test]
fn file_id_from_string() { fn file_id_from_string() {
@ -123,25 +124,27 @@ mod test {
let s2 = String::from("/home/user/testmodule-UUID-some-id.extension.imag"); let s2 = String::from("/home/user/testmodule-UUID-some-id.extension.imag");
let s3 = String::from("/home/user/testmodule-NOHASH-some-id.imag"); let s3 = String::from("/home/user/testmodule-NOHASH-some-id.imag");
let id1 = FileID::from(s1); let id1 = FileID::parse(&s1).unwrap();
let id2 = FileID::from(s2); let id2 = FileID::parse(&s2).unwrap();
let id3 = FileID::from(s3); assert!(FileID::parse(&s3).is_none());
println!("Id 1 : {:?}", id1); println!("Id 1 : {:?}", id1);
println!("Id 2 : {:?}", id2); println!("Id 2 : {:?}", id2);
println!("Id 3 : {:?}", id3);
assert_eq!(FileIDType::UUID, id1.get_type()); assert_eq!(FileIDType::UUID, id1.get_type());
assert_eq!(FileIDType::UUID, id2.get_type()); assert_eq!(FileIDType::UUID, id2.get_type());
assert_eq!(FileIDType::NONE, id3.get_type());
let h1 : String = id1.get_id().into();
let h2 : String = id2.get_id().into();
assert_eq!(String::from("some-id"), h1);
assert_eq!(String::from("some-id"), h2);
let f1 : String = id1.into(); let f1 : String = id1.into();
let f2 : String = id2.into(); let f2 : String = id2.into();
let f3 : String = id3.into();
assert_eq!(String::from("some-id"), f1); assert_eq!(String::from("UUID-some-id"), f1);
assert_eq!(String::from("some-id"), f2); assert_eq!(String::from("UUID-some-id"), f2);
assert_eq!(String::from("INVALID"), f3);
} }
fn setup_logger() { fn setup_logger() {

View file

@ -100,10 +100,10 @@ impl Debug for File {
mod test { mod test {
// we use the JSON parser here, so we can generate FileHeaderData // we use the JSON parser here, so we can generate FileHeaderData
use storage::json::parser::JsonHeaderParser; use storage::json::parser::JsonHeaderParser;
use super::match_header_spec; use storage::file::header::match_header_spec;
use storage::parser::{FileHeaderParser, ParserError}; use storage::parser::{FileHeaderParser, ParserError};
use storage::file::FileHeaderData as FHD; use storage::file::header::data::FileHeaderData as FHD;
use storage::file::FileHeaderSpec as FHS; use storage::file::header::spec::FileHeaderSpec as FHS;
#[test] #[test]
fn test_spec_matching() { fn test_spec_matching() {

View file

@ -148,10 +148,12 @@ impl Serialize for FileHeaderData {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::ops::Deref;
use super::JsonHeaderParser; use super::JsonHeaderParser;
use storage::parser::{FileHeaderParser, ParserError}; use storage::parser::{FileHeaderParser, ParserError};
use storage::file::FileHeaderData as FHD; use storage::file::header::data::FileHeaderData as FHD;
use storage::file::FileHeaderSpec as FHS; use storage::file::header::spec::FileHeaderSpec as FHS;
#[test] #[test]
fn test_deserialization() { fn test_deserialization() {
@ -177,9 +179,9 @@ mod test {
Some(FHD::Map{keys: keys}) => { Some(FHD::Map{keys: keys}) => {
for k in keys { for k in keys {
match k { match k {
FHD::Key{name: name, value: box value} => { FHD::Key{name: name, value: value} => {
assert!(name == "a" || name == "b", "Key unknown"); assert!(name == "a" || name == "b", "Key unknown");
match &value { match value.deref() {
&FHD::UInteger(u) => assert_eq!(u, 1), &FHD::UInteger(u) => assert_eq!(u, 1),
&FHD::Integer(i) => assert_eq!(i, -2), &FHD::Integer(i) => assert_eq!(i, -2),
_ => assert!(false, "Integers are not here"), _ => assert!(false, "Integers are not here"),