aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-03-14 18:15:08 +0000
committergingerBill <bill@gingerbill.org>2021-03-14 18:15:08 +0000
commit468ad4837b9f5705943433efd84e8d72625880d4 (patch)
treeedcd0cee1da651427f5414dc8ce1e35561abff0e /core
parent2aa588209e784274136b516224372fdd677d3e8f (diff)
Add `pkg` field to `testing.Internal_Test`
Diffstat (limited to 'core')
-rw-r--r--core/testing/runner.odin21
-rw-r--r--core/testing/testing.odin3
2 files changed, 21 insertions, 3 deletions
diff --git a/core/testing/runner.odin b/core/testing/runner.odin
index 35f7afde1..59fee7e0e 100644
--- a/core/testing/runner.odin
+++ b/core/testing/runner.odin
@@ -4,6 +4,7 @@ package testing
import "core:io"
import "core:os"
import "core:strings"
+import "core:slice"
reset_t :: proc(t: ^T) {
clear(&t.cleanups);
@@ -28,6 +29,15 @@ runner :: proc(internal_tests: []Internal_Test) -> bool {
total_success_count := 0;
total_test_count := len(internal_tests);
+ slice.sort_by(internal_tests, proc(a, b: Internal_Test) -> bool {
+ if a.pkg < b.pkg {
+ return true;
+ }
+ return a.name < b.name;
+ });
+
+ prev_pkg := "";
+
for it in internal_tests {
if it.p == nil {
total_test_count -= 1;
@@ -40,7 +50,12 @@ runner :: proc(internal_tests: []Internal_Test) -> bool {
name := strings.trim_prefix(it.name, "test_");
- logf(t, "[Test: %q]", name);
+ if prev_pkg != it.pkg {
+ prev_pkg = it.pkg;
+ logf(t, "[Package: %s]", it.pkg);
+ }
+
+ logf(t, "[Test: %s]", name);
// TODO(bill): Catch panics
{
@@ -48,9 +63,9 @@ runner :: proc(internal_tests: []Internal_Test) -> bool {
}
if t.error_count != 0 {
- logf(t, "[%q : FAILURE]", name);
+ logf(t, "[%s : FAILURE]", name);
} else {
- logf(t, "[%q : SUCCESS]", name);
+ logf(t, "[%s : SUCCESS]", name);
total_success_count += 1;
}
}
diff --git a/core/testing/testing.odin b/core/testing/testing.odin
index d9d4a53a3..a431d8575 100644
--- a/core/testing/testing.odin
+++ b/core/testing/testing.odin
@@ -3,9 +3,12 @@ package testing
import "core:fmt"
import "core:io"
+// IMPORTANT NOTE: Compiler requires this layout
Test_Signature :: proc(^T);
+// IMPORTANT NOTE: Compiler requires this layout
Internal_Test :: struct {
+ pkg: string,
name: string,
p: Test_Signature,
}