preserve application and error inference in test builds
This commit is contained in:
+23
-2
@@ -12827,9 +12827,25 @@ native_test_framework_discovers_reports_and_preserves_main :: proc(t: ^testing.T
|
||||
|
||||
test import "../dependency"
|
||||
|
||||
main func() i32 { return 77 }
|
||||
Token :: struct { start int }
|
||||
OperationError :: enum { failed }
|
||||
|
||||
scan func() void {
|
||||
cursor usize = 0
|
||||
_ = Token{start = cursor}
|
||||
}
|
||||
|
||||
operation func(fail bool) void ! OperationError {
|
||||
if (fail) return .failed
|
||||
}
|
||||
|
||||
main func() i32 {
|
||||
scan()
|
||||
return 77
|
||||
}
|
||||
|
||||
root_passes test {
|
||||
try operation(false)
|
||||
try testing.expect(true)
|
||||
}
|
||||
|
||||
@@ -12840,6 +12856,10 @@ root_fails test {
|
||||
root_continues test {
|
||||
try testing.expect(true)
|
||||
}
|
||||
|
||||
root_errors test {
|
||||
try operation(true)
|
||||
}
|
||||
`
|
||||
dependency_text := `testing :: import "@std/testing"
|
||||
|
||||
@@ -12873,9 +12893,10 @@ dependency_passes test {
|
||||
testing.expect(t, strings.contains(output, "FAIL root.root_fails"))
|
||||
testing.expect(t, strings.contains(output, "expected 42, found 41"))
|
||||
testing.expect(t, strings.contains(output, "PASS root.root_continues"))
|
||||
testing.expect(t, strings.contains(output, "FAIL root.root_errors"))
|
||||
testing.expect(t, strings.contains(output, "PASS dependency.dependency_passes"))
|
||||
testing.expect(t, strings.contains(output, root_path))
|
||||
testing.expect(t, strings.contains(output, "3 passed, 1 failed"))
|
||||
testing.expect(t, strings.contains(output, "3 passed, 2 failed"))
|
||||
}
|
||||
|
||||
@(test)
|
||||
|
||||
Reference in New Issue
Block a user