Skip to content
Snippets Groups Projects
Commit 98d41d74 authored by cxb23's avatar cxb23
Browse files

added to student_test.sh and passed tests. fully finished with coding assigmment

parent 7bec628c
Branches
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Create your unit tests suit in this file # Create your unit tests suit in this file
@test "Example: check ls runs without errors" { @test "Example: check ls runs without errors" {
run ./dsh <<EOF run "./dsh" <<EOF
ls ls
EOF EOF
...@@ -13,11 +13,27 @@ EOF ...@@ -13,11 +13,27 @@ EOF
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
} }
@test "Change directory to bats" { @test "Change directory, then remove directory" {
run ./dsh <<EOF run "./dsh" <<EOF
cd bats cd dsh-test
cd ..
rm dsh-test
EOF EOF
[ "$status" -eq 0 ]
}
@test "check echo runs without errors" {
run "./dsh" << EOF
echo "helloooooo sailor"
EOF
# Strip all whitespace (spaces, tabs, newlines) from the output
stripped_output=$(echo "$output" | tr -d '\t\n\r\f\v')
# Expected output with all whitespace removed for easier matching
expected_output="helloooooo sailordsh2> dsh2> cmd loop returned 0"
[ "$stripped_output" = "$expected_output" ] [ "$stripped_output" = "$expected_output" ]
[ "$status" -eq 0] [ "$status" -eq 0 ]
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment