mbpfan-josie

Propagate exit code from unit tests

Also flag errors more clearly.  References #164.

b0cdfd4c276476d41f9fe2f6326fbcd4e9fa08bc
Andrew Gaul <andrew@gaul.org> · 2018-09-13T10:06 · browse files at this commit

parents: 8db63a4

diff --git a/src/main.c b/src/main.c
index 5b92af4..4413e89 100644
--- a/src/main.c
+++ b/src/main.c
@@ -157,9 +157,7 @@ int main(int argc, char *argv[])
             break;
 
         case 't':
-            tests();
-            exit(EXIT_SUCCESS);
-            break;
+            return tests();
 
         case 'v':
             verbose = 1;
diff --git a/src/minunit.c b/src/minunit.c
index 4b8aaca..8e88eea 100644
--- a/src/minunit.c
+++ b/src/minunit.c
@@ -202,7 +202,7 @@ int tests()
     const char *result = all_tests();
 
     if (result != 0) {
-        printf("%s \n", result);
+        printf("Error: %s \n", result);
 
     } else {
         printf("ALL TESTS PASSED\n");