Commits

croach  committed 7b36dd4

Update `test_space_in_path` in to work with properly the Z-shell

  • Participants
  • Parent commits 6871383
  • Branches issue_164

Comments (0)

Files changed (1)

File tests/test_project_cd.sh

 }
 
 test_space_in_path () {
+    # Running the test code in a subshell to make it possible to catch and report
+    # errors that occur within the cdproject command. This is a problem only for
+    # z-shell. When running the test code below in zsh, it is possible that an error
+    # will occur causing the test code to short circuit before the assert statement
+    # can be called making the test look as if it completed properly.
+    (
     old_project_home="$PROJECT_HOME"
     PROJECT_HOME="$PROJECT_HOME/with spaces"
     mkdir -p "$PROJECT_HOME"
     mkproject "myproject" >/dev/null 2>&1
     cd $TMPDIR
     cdproject
-    assertSame "$PROJECT_HOME/myproject" "$(pwd)"
+    typeset -i result=0
+    if [ "$PROJECT_HOME/myproject" != "$(pwd)" ]; then
+        result=1
+    fi
     deactivate
     PROJECT_HOME="$old_project_home"
+    return $result
+    )
+    assertTrue 'project path does not equal the present working directory' "[ $? -eq 0 ]"
 }
 
-
 . "$test_dir/shunit2"