From 3ab7bf5d533317482422ea3aef2a6f030150165f Mon Sep 17 00:00:00 2001 From: Vanshika Mohan Bongade <vb525@drexel.edu> Date: Sat, 22 Feb 2025 23:31:40 +0000 Subject: [PATCH] Upload New File --- WEEK-7/bats/assignment_tests.sh | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 WEEK-7/bats/assignment_tests.sh diff --git a/WEEK-7/bats/assignment_tests.sh b/WEEK-7/bats/assignment_tests.sh new file mode 100644 index 0000000..ddce4c5 --- /dev/null +++ b/WEEK-7/bats/assignment_tests.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bats + +############################ DO NOT EDIT THIS FILE ##################################### +# File: assignment_tests.sh +# +# DO NOT EDIT THIS FILE +# +# Add/Edit Student tests in student_tests.sh +# +# All tests in this file must pass - it is used as part of grading! +######################################################################################## + +@test "Pipes" { + run "./dsh" <<EOF +ls | grep dshlib.c +EOF + + # Strip spaces and newlines from the output + stripped_output=$(echo "$output" | tr -d '[:space:]') + + # Adjusted expected output format + expected_output="dshlib.c" + + # Debugging output if test fails + echo "Captured stdout:" + echo "Output: $output" + echo "Exit Status: $status" + echo "${stripped_output} -> ${expected_output}" + + # Check for expected output + [[ "$stripped_output" == *"$expected_output"* ]] + + # Assertions + [ "$status" -eq 0 ] +} -- GitLab