From b064528c596aa80046a407ac77b3e4cab3f6c0b3 Mon Sep 17 00:00:00 2001 From: Nathan Lilienthal Date: Fri, 15 Sep 2023 11:30:43 -0400 Subject: [PATCH] Add a couple more variable assignment tests. --- tests/posix.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/posix.rs b/tests/posix.rs index 47f1f942..c7f9e8a3 100644 --- a/tests/posix.rs +++ b/tests/posix.rs @@ -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");