Skip to content

Commit

Permalink
Add a couple more variable assignment tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nixpulvis committed Sep 15, 2023
1 parent 0870cf6 commit b064528
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,13 @@ fn assignment_command() {

#[test]
fn variable_command() {
assert_posix!("X=1; echo $X", "1\n"); // This is wrong. $X should expand outside the
// environment where it's set.
assert_posix!("X=1; echo $X", "1\n");
assert_posix!("X=1 echo $X", "\n");
assert_posix!("X=1; printenv X", "\n");
assert_posix!("X=1 printenv X", "1\n");

assert_posix!("export FOO=1 BAR=$FOO; echo $BAR", "1\n");

assert_posix!("echo $BAR", "\n");
assert_posix!("echo $", "$\n");
assert_posix!("echo ' $ '", " $ \n");
Expand Down

0 comments on commit b064528

Please sign in to comment.