1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#[macro_use]
extern crate serde;
extern crate serde_derive;
extern crate serde_json;

pub mod runtime;
mod serdes;

#[cfg(test)]
mod tests {
    use crate::runtime::Spec;

    #[test]
    fn test_load() {
        match Spec::load("config.json") {
            Ok(_) => {},
            Err(e) => panic!("{}", e),    
        }
    }

    #[test]
    fn test_save() {
        let spec = match Spec::load("config.json") {
            Ok(s) => s,
            Err(e) => panic!("{}", e),    
        };
        match Spec::save(&spec, "config.json") {
            Ok(_) => {},
            Err(e) => panic!("{}", e),    
        }
    }
}