]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - test.c
Some style fixes for tests
[xonotic/gmqcc.git] / test.c
diff --git a/test.c b/test.c
index 64c9928e7fc2c82eb8a01dc9d2bdabb0fd1bb7c1..6fdee5134de3d07d85738035f881d62b2234a1a8 100644 (file)
--- a/test.c
+++ b/test.c
@@ -184,7 +184,7 @@ static int task_pclose(FILE **handles) {
         return open->handles;
     }
 
-    static void task_pclose(FILE **files) {
+    static int task_pclose(FILE **files) {
         popen_t *open = ((popen_t*)files);
         fs_file_close(files[1]);
         fs_file_close(files[2]);
@@ -192,6 +192,8 @@ static int task_pclose(FILE **handles) {
         remove(open->name_out);
 
         mem_d(open);
+
+        return EXIT_SUCCESS;
     }
 #   define popen _popen
 #   define pclose _pclose
@@ -443,9 +445,6 @@ static bool task_template_parse(const char *file, task_template_t *tmpl, FILE *f
                     goto failure;
                 }
 
-                if (value && (*value == ' ' || *value == '\t'))
-                    value++;
-
                 /*
                  * Value will contain a newline character at the end, we need to strip
                  * this otherwise kaboom, seriously, kaboom :P
@@ -964,6 +963,7 @@ static void task_destroy(void) {
 static bool task_trymatch(size_t i, char ***line) {
     bool             success = true;
     bool             process = true;
+    int              retval  = EXIT_SUCCESS;
     FILE            *execute;
     char             buffer[4096];
     task_template_t *tmpl = task_tasks[i].tmpl;
@@ -1085,16 +1085,20 @@ static bool task_trymatch(size_t i, char ***line) {
             data = NULL;
             size = 0;
         }
+
+        if (compare != vec_size(tmpl->comparematch))
+            success = false;
+
         mem_d(data);
         data = NULL;
     }
 
     if (process)
-        pclose(execute);
+        retval = pclose(execute);
     else
         fs_file_close(execute);
 
-    return success;
+    return success && retval == EXIT_SUCCESS;
 }
 
 static const char *task_type(task_template_t *tmpl) {
@@ -1419,6 +1423,5 @@ int main(int argc, char **argv) {
     succeed = test_perform("tests", defs);
     stat_info();
 
-
     return (succeed) ? EXIT_SUCCESS : EXIT_FAILURE;
 }