Skip to content

Commit

Permalink
Add some more parser tests for common commands
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Mar 25, 2024
1 parent ed97df8 commit a1d4bad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/line/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ mod tests {
assert_eq!(parse("echo").unwrap(), cmd_stmt(lit_invocation(["echo"])));
assert_eq!(parse("echo 123").unwrap(), cmd_stmt(lit_invocation(["echo", "123"])));
assert_eq!(parse("echo \"123\"").unwrap(), cmd_stmt(lit_invocation(["echo", "123"])));
assert_eq!(parse("ls -la").unwrap(), cmd_stmt(lit_invocation(["ls", "-la"])));
assert_eq!(parse(" pwd --help ").unwrap(), cmd_stmt(lit_invocation(["pwd", "--help"])));
assert_eq!(parse("pwd--help").unwrap(), cmd_stmt(lit_invocation(["pwd--help"])));
assert_eq!(parse("cd..").unwrap(), cmd_stmt(lit_invocation(["cd.."])));
assert_eq!(parse("cd ..").unwrap(), cmd_stmt(lit_invocation(["cd", ".."])));
assert_eq!(parse("cd ./test/../../.").unwrap(), cmd_stmt(lit_invocation(["cd", "./test/../../."])));
}

#[test]
Expand Down

0 comments on commit a1d4bad

Please sign in to comment.