Exiting with 1 when the test wasn't successful

The TestMain class can be used for native target as well, in which cases the `Sys.exit(0)` call ignores the state of the tests. Returning `0` or `1` depending on the success of the tests allows for a better integration with build systems.