]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Better output on failure
authorDale Weiler <killfieldengine@gmail.com>
Sun, 21 Apr 2013 06:46:39 +0000 (06:46 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sun, 21 Apr 2013 06:46:39 +0000 (06:46 +0000)
test.c
tests/builtin.tmpl

diff --git a/test.c b/test.c
index 8247734f67bb7764afbcca6f97c15952367a7c01..107140e5cc7697f4a7e5e346e7334f12dd7a53cb 100644 (file)
--- a/test.c
+++ b/test.c
@@ -1069,11 +1069,12 @@ void task_schedualize(size_t *pad) {
         }
 
         if (!task_tasks[i].compiled && strcmp(task_tasks[i].tmpl->proceduretype, "-fail")) {
-            con_err("failure: `%s` (failed to compile) see %s.stdout and %s.stderr [%s]\n",
+            con_out("failure:   `%s` %*s %*s\n",
                 task_tasks[i].tmpl->description,
-                task_tasks[i].tmpl->tempfilename,
-                task_tasks[i].tmpl->tempfilename,
-                task_tasks[i].tmpl->rulesfile
+                (pad[0] + pad[1] - strlen(task_tasks[i].tmpl->description)) + (strlen(task_tasks[i].tmpl->rulesfile) - pad[1]),
+                task_tasks[i].tmpl->rulesfile,
+                (pad[1] + pad[2] - strlen(task_tasks[i].tmpl->rulesfile)) + (strlen("(failed to compile)") - pad[2]),
+                "(failed to compile)"
             );
             continue;
         }
@@ -1098,12 +1099,18 @@ void task_schedualize(size_t *pad) {
         if (!task_trymatch(task_tasks[i].tmpl, &match)) {
             size_t d = 0;
 
-            con_err("failure: `%s` (invalid results from %s) [%s]\n",
+            con_out("failure:   `%s` %*s %*s\n",
                 task_tasks[i].tmpl->description,
+                (pad[0] + pad[1] - strlen(task_tasks[i].tmpl->description)) + (strlen(task_tasks[i].tmpl->rulesfile) - pad[1]),
+                task_tasks[i].tmpl->rulesfile,
+                (pad[1] + pad[2] - strlen(task_tasks[i].tmpl->rulesfile)) + (strlen(
+                    (strcmp(task_tasks[i].tmpl->proceduretype, "-pp"))
+                        ? "(invalid results from execution)"
+                        : "(invalid results from preprocessing)"
+                ) - pad[2]),
                 (strcmp(task_tasks[i].tmpl->proceduretype, "-pp"))
-                    ? "execution"
-                    : "preprocessing",
-                task_tasks[i].tmpl->rulesfile
+                    ? "(invalid results from execution)"
+                    : "(invalid results from preprocessing)"
             );
 
             /*
@@ -1111,7 +1118,7 @@ void task_schedualize(size_t *pad) {
              * handler for the all the given matches in the template file and
              * what was actually returned from executing.
              */
-            con_err("    Expected From %u Matches: (got %u Matches)\n",
+            con_out("    Expected From %u Matches: (got %u Matches)\n",
                 vec_size(task_tasks[i].tmpl->comparematch),
                 vec_size(match)
             );
@@ -1119,10 +1126,10 @@ void task_schedualize(size_t *pad) {
                 char  *select = task_tasks[i].tmpl->comparematch[d];
                 size_t length = 40 - strlen(select);
 
-                con_err("        Expected: \"%s\"", select);
+                con_out("        Expected: \"%s\"", select);
                 while (length --)
-                    con_err(" ");
-                con_err("| Got: \"%s\"\n", (d >= vec_size(match)) ? "<<nothing else to compare>>" : match[d]);
+                    con_out(" ");
+                con_out("| Got: \"%s\"\n", (d >= vec_size(match)) ? "<<nothing else to compare>>" : match[d]);
             }
 
             /*
@@ -1132,7 +1139,7 @@ void task_schedualize(size_t *pad) {
              */  
             if (vec_size(match) > vec_size(task_tasks[i].tmpl->comparematch)) {
                 for (d = 0; d < vec_size(match) - vec_size(task_tasks[i].tmpl->comparematch); d++) {
-                    con_err("        Expected: Nothing                                   | Got: \"%s\"\n",
+                    con_out("        Expected: Nothing                                   | Got: \"%s\"\n",
                         match[d + vec_size(task_tasks[i].tmpl->comparematch)]
                     );
                 }
index cc14cafdd3ddc596376ebe11570291a2c644896f..03ac3ccdc74bec7dd2e4302e4c5eb98814cfdfc9 100644 (file)
@@ -4,4 +4,4 @@ D: test builtin functions
 T: -execute
 C: -std=gmqcc
 E: $null
-M: hello world
+M: hello world1