From c6da08e10db5c8c91a79c9191582b4c9519bd0ca Mon Sep 17 00:00:00 2001 From: Alireza Mohaghegh Date: Tue, 24 Sep 2024 17:43:39 -0400 Subject: [PATCH] Added tests for incrementation --- crates/tests/src/lib.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/crates/tests/src/lib.rs b/crates/tests/src/lib.rs index eb6e23e..afde640 100644 --- a/crates/tests/src/lib.rs +++ b/crates/tests/src/lib.rs @@ -868,6 +868,31 @@ async fn arithmetic() { .assert_stdout("16\n") .run() .await; + + TestBuilder::new() + .command("echo $((a=1, ++a))") + .assert_stdout("2\n") + .run() + .await; + + TestBuilder::new() + .command("echo $((a=1, a++))") + .assert_stdout("1\n") + .run() + .await; + + TestBuilder::new() + .command("echo $((a=1, a--))") + .assert_stdout("1\n") + .run() + .await; + + TestBuilder::new() + .command("echo $((a=1, --a))") + .assert_stdout("0\n") + .run() + .await; + } #[tokio::test]