Created
January 8, 2019 08:49
-
-
Save endor/38e6c585942c906d30579a138c85917e to your computer and use it in GitHub Desktop.
test.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mut all_suites: Vec<Suite> = Vec::new(); | |
let mut default_suite = Suite { | |
children: vec![], | |
name: "".to_string(), | |
status: "fail".to_string(), | |
}; | |
let mut current_suite: &mut Suite = &mut default_suite; | |
loop { | |
match reader.read_event(&mut buf) { | |
Ok(Event::Start(ref e)) if e.name() == b"status" => { | |
let suite_status = string_attribute(e.attributes(), "status"); | |
current_suite.status = suite_status.to_lowercase(); | |
}, | |
Ok(Event::Start(ref e)) if e.name() == b"suite" => { | |
let name = string_attribute(e.attributes(), "name"); | |
let suite = Suite { | |
children: vec![], | |
name: name.clone(), | |
status: "fail".to_string(), | |
}; | |
all_suites.push(suite); | |
all_suites.last_mut().map(|s| { | |
current_suite = s; | |
}); | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment