diff --git a/w7/student_tests.sh b/w7/student_tests.sh index 6187d2ea27414ec744d383dc8cbdff6e7c472eed..792fca5e95a083eab804e9ac5a9b13eb851d1967 100644 --- a/w7/student_tests.sh +++ b/w7/student_tests.sh @@ -79,33 +79,3 @@ EOF } -# Test: Append Redirection (`>>`) -@test "Append Redirection: echo Hello > test_append.txt && echo World >> test_append.txt" { - rm -f test_append.txt # Ensure file does not exist - run ./dsh <<EOF -echo Hello > test_append.txt -echo World >> test_append.txt -EOF - sleep 1 # Ensure file is written - [ "$status" -eq 0 ] - [ -f test_append.txt ] # Ensure file exists - trimmed_output=$(cat test_append.txt | tr -d '\r') - echo "Captured output: $trimmed_output" # Debugging - [[ "$trimmed_output" == *"Hello"* && "$trimmed_output" == *"World"* ]] - rm -f test_append.txt -} - -# Extra Credit: Combining Pipes and Redirection -@test "Extra Credit: ls | grep .c > output.txt" { - rm -f output.txt # Ensure file does not exist - run ./dsh <<EOF -ls | grep .c > output.txt -EOF - sleep 1 # Ensure file is written - [ "$status" -eq 0 ] - [ -f output.txt ] # Ensure file exists - trimmed_output=$(cat output.txt | tr -d '\r') - echo "Captured output: $trimmed_output" # Debugging - [[ "$trimmed_output" == *"dshlib.c"* ]] - rm -f output.txt -}