Skip to content

Commit

Permalink
fix clippy and add unix absolute path test
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveL-MSFT committed Dec 16, 2024
1 parent 6a241ab commit e5f6018
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dsc_lib/src/functions/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ impl Function for Path {
path.push(s.to_owned() + std::path::MAIN_SEPARATOR.to_string().as_str());
first = false;
continue;
} else {
path.push(s);
}
path.push(s);
} else {
return Err(DscError::Parser("Arguments must all be strings".to_string()));
}
Expand Down Expand Up @@ -72,6 +71,14 @@ mod tests {
assert_eq!(result, format!("a{separator}C:{separator}test"));
}

#[test]
fn unix_absolute_path() {
let mut parser = Statement::new().unwrap();
let separator = std::path::MAIN_SEPARATOR;
let result = parser.parse_and_execute("[path('/','a','b')]", &Context::new()).unwrap();
assert_eq!(result, format!("/a{separator}b"));
}

#[test]
fn two_args() {
let mut parser = Statement::new().unwrap();
Expand Down

0 comments on commit e5f6018

Please sign in to comment.