Skip to content

Commit

Permalink
Fix some clippy lints in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ejrh committed Jul 15, 2023
1 parent 78c11d5 commit abdbba7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions tests/test_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ fn get_test_data() -> Result<Vec<Yaml>, Box<dyn Error>> {
Ok(YamlLoader::load_from_str(&yaml_str)?)
}

#[test_case("/number_keys/1", &[&"one"], true, None)]
#[test_case("/squads/alpha", &[&"1.1"], true, None)]
#[test_case("squads.bravo", &[&"2.2"], true, None)]
#[test_case("/array_of_hashes/1", &[&"step: 2\nname: two"], true, None)]
fn test_get_nodes(yamlpath: &str, results: &[&str], mustexist: bool, default: Option<&str>) -> Result<(), Box<dyn Error>> {
let yamlpath = Path::new(&yamlpath)?;
#[test_case("/number_keys/1", &["one"], true, None)]
#[test_case("/squads/alpha", &["1.1"], true, None)]
#[test_case("squads.bravo", &["2.2"], true, None)]
#[test_case("/array_of_hashes/1", &["step: 2\nname: two"], true, None)]
fn test_get_nodes(yamlpath: &str, results: &[&str], _mustexist: bool, _default: Option<&str>) -> Result<(), Box<dyn Error>> {
let yamlpath = Path::new(yamlpath)?;

let data = get_test_data()?;
let first = &data[0];

let processor = Processor::new(&first);
let processor = Processor::new(first);
let mut count = 0;
for (idx, node) in processor.get_all(&yamlpath)?.into_iter().enumerate() {
let mut node_as_str = String::new();
Expand Down
2 changes: 1 addition & 1 deletion tests/test_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use yaml_path::{Path, Processor};
fn test_simple() {
let docs = YamlLoader::load_from_str("hello: there").unwrap();
let doc = &docs[0];
let processor = Processor::new(&doc);
let processor = Processor::new(doc);
let path = Path::new("hello").unwrap();
let results = processor.get_all(&path).unwrap();
assert_eq!(results.len(), 1);
Expand Down

0 comments on commit abdbba7

Please sign in to comment.