From 00a71248c1493aebb9c774a6c75a0ecdd30272fa Mon Sep 17 00:00:00 2001
From: Vanshika Mohan Bongade <vb525@drexel.edu>
Date: Sat, 22 Feb 2025 23:31:51 +0000
Subject: [PATCH] Upload New File

---
 WEEK-7/bats/student_tests.sh | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 WEEK-7/bats/student_tests.sh

diff --git a/WEEK-7/bats/student_tests.sh b/WEEK-7/bats/student_tests.sh
new file mode 100644
index 0000000..8b20e75
--- /dev/null
+++ b/WEEK-7/bats/student_tests.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bats
+
+@test "Basic piping: ls | grep .c" {
+    run ./dsh <<EOF
+ls | grep .c
+EOF
+    [ "$status" -eq 0 ]
+}
+
+@test "Count words using wc -w" {
+    run ./dsh <<EOF
+echo "Hello World" | wc -w
+EOF
+    output_trimmed=$(echo "$output" | tr -cd '0-9') # Remove non-numeric characters
+    echo "DEBUG: Output was '$output_trimmed'"
+    [ "$output_trimmed" = "2" ]
+}
+
+
+@test "Invalid command in pipe" {
+    run ./dsh <<EOF
+ls | invalid_cmd
+EOF
+    echo "DEBUG: Output was '$output'"
+    [[ "$output" == *"error: command not found"* ]] || [[ "$output" == *"command not found"* ]]
+}
+
+
+@test "Multiple pipes working" {
+    run ./dsh <<EOF
+cat dshlib.c | grep "int" | wc -l
+EOF
+    [ "$status" -eq 0 ]
+}
-- 
GitLab