align with new @hide syntax

This commit is contained in:
2026-08-10 22:48:38 +02:00
parent 8de7ec341e
commit 891dc6516e
13 changed files with 150 additions and 94 deletions
+23 -25
View File
@@ -1,4 +1,4 @@
testing :: import "@std/testing"
import "@std/testing"
TestTokenKind :: enum(u8) {
ident = 3
@@ -12,20 +12,21 @@ TestInner :: distinct u16
TestOuter :: distinct TestInner
TestOuterAlias :: alias TestOuter
hide array_info_matches proc($Array, $Child type, $len usize) bool {
match typeinfo!(Array) {
.array |info|: return info.child == Child and info.len == len
else: return false
}
}
hide distinct_info_matches proc($Distinct, $Backing type) bool {
match typeinfo!(Distinct) {
.distinct |backing|: return backing == Backing
else: return false
@hide
array_info_matches proc($Array, $Child type, $len usize) bool {
return match typeinfo!(Array) {
.array |info|: info.child == Child and info.len == len
else: false
}
}
@hide
distinct_info_matches proc($Distinct, $Backing type) bool {
return match typeinfo!(Distinct) {
.distinct |backing|: backing == Backing
else: false
}
}
array_reflection_exposes_child_and_logical_length test {
try testing.expect($(array_info_matches([4]i32, i32, 4)))
@@ -34,34 +35,31 @@ array_reflection_exposes_child_and_logical_length test {
try testing.expect($(array_info_matches([2]mut i64, i64, 2)))
try testing.expect($(array_info_matches([2;0]u8, u8, 2)))
}
distinct_reflection_exposes_immediate_backing test {
try testing.expect($(distinct_info_matches(TestInner, u16)))
try testing.expect($(distinct_info_matches(TestOuter, TestInner)))
try testing.expect($(distinct_info_matches(TestOuterAlias, TestInner)))
}
enum_field_struct_defaults test {
names TestNames := {
ident = "identifier",
int = "integer",
}
if field!(names, "ident") |value| {
if (field!(names, "ident")) |value|
try testing.expect(value.len == 10)
} else {
else
try testing.expect(false)
}
if field!(names, "int") |value| {
if (field!(names, "int")) |value|
try testing.expect(value.len == 7)
} else {
else
try testing.expect(false)
}
if field!(names, "eof") |_| {
try testing.expect(false)
}
if (field!(names, "eof")) |_| try testing.expect(false)
empty TestNames := {}
if field!(empty, "ident") |_| {
try testing.expect(false)
}
if (field!(empty, "ident")) |_| try testing.expect(false)
}