diff --git a/4-ShellP2/.dshlib.c.swp b/4-ShellP2/.dshlib.c.swp deleted file mode 100644 index 7b1c66f6e023becd69f71d5ed390e4de36e131a8..0000000000000000000000000000000000000000 Binary files a/4-ShellP2/.dshlib.c.swp and /dev/null differ diff --git a/4-ShellP2/bats/.assignment_test.sh.swp b/4-ShellP2/bats/.assignment_test.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..fde799a3ba9807e5e16e113b95332c966a0b8b85 Binary files /dev/null and b/4-ShellP2/bats/.assignment_test.sh.swp differ diff --git a/4-ShellP2/bats/.student_test.sh.swp b/4-ShellP2/bats/.student_test.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..1ac057dfda0d92c4c518a6a348665f5c3142d354 Binary files /dev/null and b/4-ShellP2/bats/.student_test.sh.swp differ diff --git a/4-ShellP2/bats/assignment_test.sh b/4-ShellP2/bats/assignment_test.sh index 30b12ec1661cd179396f1e2ee3fd8ef39de7eb96..b8457627515cb75b9d1ee54d5e42882fb3f670d4 100644 --- a/4-ShellP2/bats/assignment_test.sh +++ b/4-ShellP2/bats/assignment_test.sh @@ -97,7 +97,7 @@ EOF @test "It handles quoted spaces" { run "./dsh" <<EOF - echo " hello world " +echo " hello world " EOF # Strip all whitespace (spaces, tabs, newlines) from the output diff --git a/4-ShellP2/bats/student_test.sh b/4-ShellP2/bats/student_test.sh index 638bc341446f7580a80c2aff52971b8023407ea8..4e54a366ee094b60873c701fb0f68eec9f9f9217 100644 --- a/4-ShellP2/bats/student_test.sh +++ b/4-ShellP2/bats/student_test.sh @@ -12,3 +12,12 @@ EOF # Assertions [ "$status" -eq 0 ] } + +@test "Change directory to bats" { + run ./dsh <<EOF +cd bats +EOF + [ "$stripped_output" = "$expected_output" ] + + [ "$status" -eq 0] +} diff --git a/4-ShellP2/dsh b/4-ShellP2/dsh index bc71f23f06921448398c90d8c8ef9609de2dbfd4..01c20559967f638402f75036f995d77937e63f65 100755 Binary files a/4-ShellP2/dsh and b/4-ShellP2/dsh differ diff --git a/4-ShellP2/dshlib.c b/4-ShellP2/dshlib.c index c168f6dc0858734439c9fa1cbd0fd50290b4fcea..77fb323e4887c39705c1ba3f35ccd2b74e07af5f 100644 --- a/4-ShellP2/dshlib.c +++ b/4-ShellP2/dshlib.c @@ -197,7 +197,7 @@ int exec_local_cmd_loop() if (strcmp(cmd_buff, "rc") == 0) { printf("%d\n", rc); - if ((rc = clear_cmd_buff(cmd)) != OK_EXIT) exit(rc); + //if ((rc = clear_cmd_buff(cmd)) != OK_EXIT) exit(rc); continue; }