diff --git a/5-ShellP3/bats/student_tests.sh b/5-ShellP3/bats/student_tests.sh index 1241ea9cfc3db5e7d9276cc665f87f03a2d0c727..2abe067b4ac24f6abe14782f98138af458570efd 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 ] +} + +