exercism / nim-test-runner

GNU Affero General Public License v3.0
2 stars 3 forks source link

Fix(unittest_json): Change order of JSON keys #4

Closed ee7 closed 4 years ago

ee7 commented 4 years ago

This PR changes the JSON generated by unittest_json.nim to conform slightly better with the spec.

Consider an example: a single-test test file that fails. This PR causes the following diff:

{
+  "status": "fail",
   "tests": [
     {
       "name": "two() returns 2",
-      "output": "",
       "status": "fail",
-      "message": "/some/path/some_file.nim(8, 18): Check failed: two() == 2\\ntwo() was 0"
+      "message": "/some/path/some_file.nim(8, 18): Check failed: two() == 2\\ntwo() was 0",
+      "output": ""
     }
-  ],
+  ]
-  "status": "fail"
 }

See the commit message for more details.

ynfle commented 4 years ago

What about stripping from stack traces?

ynfle commented 4 years ago

I think we can merge the orderings. The reason they were there in the first place is that I started off just manually writing to the JSON file (before I figured out that the JSON module can dump an object) and the status was only known after the tests run.