From 09dcc55ca29a89e4560369af797754b14145f99f Mon Sep 17 00:00:00 2001 From: Bao Mai <bgm47@drexel.edu> Date: Tue, 4 Mar 2025 23:35:46 -0500 Subject: [PATCH] update test --- 5-ShellP3/bats/student_tests.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/5-ShellP3/bats/student_tests.sh b/5-ShellP3/bats/student_tests.sh index 1241ea9..2abe067 100644 --- a/5-ShellP3/bats/student_tests.sh +++ b/5-ShellP3/bats/student_tests.sh @@ -11,4 +11,23 @@ EOF # Assertions [ "$status" -eq 0 ] -} \ No newline at end of file +} + +@test "Piped commands: echo, tr, and rev" { + run "./dsh" <<EOF +echo "hello world" | tr '[:lower:]' '[:upper:]' | rev +EOF + + stripped_output=$(echo "$output" | tr -d '[:space:]') + expected_output="DLROWOLLEHdsh3>dsh3>cmdloopreturned0" + + echo "Captured stdout:" + echo "Output: $output" + echo "Exit Status: $status" + echo "${stripped_output} -> ${expected_output}" + + [ "$stripped_output" = "$expected_output" ] + [ "$status" -eq 0 ] +} + + -- GitLab