Skip to content
Snippets Groups Projects
Commit a6d1ec37 authored by vht24's avatar vht24
Browse files

update

parent 029b7f06
No related branches found
No related tags found
No related merge requests found
......@@ -96,3 +96,29 @@ EOF
expected_output="Errorexecutingnocommand:Nosuchfileordirectorydsh2>dsh2>dsh2>2dsh2>cmdloopreturned0"
[ "$stripped_output" = "$expected_output" ]
}
# Test: Check 'dragon' built-in command prints dragon
@test "Check dragon command prints dragon" {
run ./dsh <<EOF
dragon
EOF
[ "$status" -eq 0 ]
}
# Test: Check handling of permission denied error
@test "Check handling of permission denied" {
touch testfile
chmod -r testfile
run ./dsh <<EOF
./testfile
rc
EOF
stripped_output=$(echo "$output" | tr -d '[:space:]')
expected_output="Errorexecuting./testfile:Permissiondenieddsh2>dsh2>dsh2>13dsh2>cmdloopreturned0"
echo "Captured stdout:"
echo "Output: $output"
echo "Exit Status: $status"
echo "${stripped_output} -> ${expected_output}"
[ "$stripped_output" = "$expected_output" ]
rm testfile
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment