]> git.notmuchmail.org Git - notmuch/blobdiff - test/T560-lib-error.sh
test: make script exit (1) if it "fails" to source (.) a file
[notmuch] / test / T560-lib-error.sh
index 9f5f7aefeea2e2c6fd44abc28c5e7ca29031840c..1ef4ff23a37f1e30a69c878d8d81b67e01339e97 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 test_description="error reporting for library"
 
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
 
 backup_database () {
     rm -rf notmuch-dir-backup
@@ -36,7 +36,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Open relative path"
-test_subtest_known_broken
 test_C <<'EOF'
 #include <stdio.h>
 #include <notmuch.h>
@@ -55,7 +54,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Create database in relative path"
-test_subtest_known_broken
 test_C <<'EOF'
 #include <stdio.h>
 #include <notmuch.h>
@@ -108,21 +106,21 @@ Error: Cannot create a database for a NULL path.
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
-test_begin_subtest "Create database in non-existant directory"
-test_C <<'EOF'
+test_begin_subtest "Create database in nonexistent directory"
+test_C ${PWD}/nonexistent/foo<<'EOF'
 #include <stdio.h>
 #include <notmuch.h>
 int main (int argc, char** argv)
 {
     notmuch_database_t *db;
     notmuch_status_t stat;
-    stat = notmuch_database_create ("./nonexistent/foo", &db);
+    stat = notmuch_database_create (argv[1], &db);
 }
 EOF
 cat <<'EOF' >EXPECTED
 == stdout ==
 == stderr ==
-Error: Cannot create database at ./nonexistent/foo: No such file or directory.
+Error: Cannot create database at CWD/nonexistent/foo: No such file or directory.
 EOF
 test_expect_equal_file EXPECTED OUTPUT