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:
2026-06-24 22:59:32 +09:00
parent 246e5bb90e
commit 132ea4ee60
41 changed files with 950 additions and 3160 deletions

View File

@@ -0,0 +1,80 @@
// arraytoslice_test — #258: the implicit [N]T -> []T array-to-slice BORROW at
// assign / return / call-arg / let init (.ptr = &arr[0], .len = .cap = N).
// Migrated from test/wcc/953_arraytoslice_run.c (value rows; cs==ww byte-id
// rides T2). The element-type-mismatch reject rows stay as runww //ww:error
// carriers under test/wcc/data/.
//
// The fix is a checker-only desugar to the explicit full slice arr[0:len(arr)];
// cgen is untouched. Each row asserts through .ptr-deref (indexing) AND .cap,
// not just .len — a wrong borrow with the right len but a wrong ptr/cap would
// otherwise pass. borrow_i32 mutates through the slice and reads the backing
// array (alias, not copy).
package arraytoslice_test;
let g: [3]i32 = [7, 8, 9];
fn mk() []i32 = { return g; };
fn sum_i32(s: []i32) i32 = {
assert(s.cap == 4);
let t: i32 = 0; let i: i32 = 0;
for (i < s.len) { t += s[i]; i += 1; };
return t;
};
fn sum_u8(s: []u8) i32 = {
assert(s.cap == 3);
let t: i32 = 0; let i: i32 = 0;
for (i < s.len) { t += s[i]: i32; i += 1; };
return t;
};
@test fn let_i32() void = {
let a: [4]i32 = [11, 22, 33, 44];
let s: []i32 = a;
assert(s[2] == 33);
assert(s.len == 4);
assert(s.cap == 4);
};
@test fn let_u8() void = {
let a: [4]u8 = [11u8, 22u8, 33u8, 66u8];
let s: []u8 = a;
assert(s[3]: i32 == 66);
assert(s.len == 4);
assert(s.cap == 4);
};
@test fn assign_i32() void = {
let a: [4]i32 = [1, 2, 3, 4];
let s: []i32 = a[0:1];
s = a;
assert(s[3] == 4);
assert(s.len == 4);
assert(s.cap == 4);
};
@test fn callarg_i32() void = {
let a: [4]i32 = [10, 20, 30, 5];
assert(sum_i32(a) == 65);
};
@test fn callarg_u8() void = {
let a: [3]u8 = [10u8, 20u8, 40u8];
assert(sum_u8(a) == 70);
};
@test fn return_i32() void = {
let s: []i32 = mk();
assert(s.len == 3);
assert(s.cap == 3);
assert(s[1] + s[2] == 17);
};
@test fn borrow_i32() void = {
let a: [4]i32 = [1, 2, 3, 4];
let s: []i32 = a;
s[2] = 55;
assert(a[2] == 55);
};