Skip to content

Commit e5f6018

Browse files
committed
fix clippy and add unix absolute path test
1 parent 6a241ab commit e5f6018

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

dsc_lib/src/functions/path.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ impl Function for Path {
3939
path.push(s.to_owned() + std::path::MAIN_SEPARATOR.to_string().as_str());
4040
first = false;
4141
continue;
42-
} else {
43-
path.push(s);
4442
}
43+
path.push(s);
4544
} else {
4645
return Err(DscError::Parser("Arguments must all be strings".to_string()));
4746
}
@@ -72,6 +71,14 @@ mod tests {
7271
assert_eq!(result, format!("a{separator}C:{separator}test"));
7372
}
7473

74+
#[test]
75+
fn unix_absolute_path() {
76+
let mut parser = Statement::new().unwrap();
77+
let separator = std::path::MAIN_SEPARATOR;
78+
let result = parser.parse_and_execute("[path('/','a','b')]", &Context::new()).unwrap();
79+
assert_eq!(result, format!("/a{separator}b"));
80+
}
81+
7582
#[test]
7683
fn two_args() {
7784
let mut parser = Statement::new().unwrap();

0 commit comments

Comments
 (0)