test: migrate Fam13 misc checker/coercion value tests to @test (#5-C6)
Final fold-2 chunk. The 12 Fam13 single-file value drivers move from test/wcc/*_run.c into in-language @test row-tables under test/lang/: - value rows -> test/lang/*_test.ww (12 files) - reject rows -> runww //ww:error carriers (13, dual-stage non-vacuous) - nullable abort rows -> runww //ww:run-exit 1 carriers (3) - 953_globalslice_arg -> _runonly (cs!=ww checker divergence, #28) - 788 value_not_type_neg + 953_arrlit_slice reject_assign kept as slim rc-only .c pins (divergent-diag dual-reject, mutation-gated); 788 #29 Coverage parity verified row-by-row vs each retired driver; advisor- ratified carve taxonomy; two-round reviewed. Floor ratchet follows.
This commit is contained in:
46
test/lang/arrlit_elem_narrow_test.ww
Normal file
46
test/lang/arrlit_elem_narrow_test.ww
Normal file
@@ -0,0 +1,46 @@
|
||||
// arrlit_elem_narrow_test — #251: narrow int/rune array-literal elements to a
|
||||
// declared [N]T element type at the let / def / struct-field init sites.
|
||||
// Migrated from test/wcc/951_arrlit_elem_narrow_run.c (accept rows; cs==ww
|
||||
// byte-id rides T2). The out-of-range and str-elem reject rows stay as runww
|
||||
// //ww:error carriers under test/wcc/data/.
|
||||
//
|
||||
// Pre-#251 cstage REJECTED in-range bare-int/rune lits at local let/def/struct
|
||||
// ("[4]i32 not assignable to [4]u8"); wwstage SILENTLY over-accepted out-of-
|
||||
// range/str at def + struct-field (a rule-7 miscompile). Element WIDTH is
|
||||
// declared-type-driven at cgen, so the byte-id gate confirms the emitted bytes
|
||||
// are u8-wide regardless of the literal node type.
|
||||
|
||||
package arrlit_elem_narrow_test;
|
||||
|
||||
type enc = struct { m: [4]u8 };
|
||||
|
||||
def D_int: [4]u8 = [65, 66, 67, 68];
|
||||
def D_rune: [4]u8 = ['A', 'B', 'C', 'D'];
|
||||
let E: enc = enc { m = [65, 66, 67, 68] };
|
||||
|
||||
@test fn let_int() void = {
|
||||
let a: [4]u8 = [65, 66, 67, 68];
|
||||
assert(a[0]: i32 == 65);
|
||||
};
|
||||
|
||||
@test fn let_rune() void = {
|
||||
let a: [4]u8 = ['A', 'B', 'C', 'D'];
|
||||
assert(a[0]: i32 == 65);
|
||||
};
|
||||
|
||||
@test fn def_int() void = {
|
||||
assert(D_int[0]: i32 == 65);
|
||||
};
|
||||
|
||||
@test fn def_rune() void = {
|
||||
assert(D_rune[0]: i32 == 65);
|
||||
};
|
||||
|
||||
@test fn struct_int() void = {
|
||||
assert(E.m[0]: i32 == 65);
|
||||
};
|
||||
|
||||
@test fn struct_rune() void = {
|
||||
let e: enc = enc { m = ['A', 'B', 'C', 'D'] };
|
||||
assert(e.m[1]: i32 == 66);
|
||||
};
|
||||
Reference in New Issue
Block a user