//:expect-panic linkdata slice: cap is foreign (copy it first) //:wasmtest skip /* A //:linkdata binding has foreign storage. push on it must die with a message that names the cause - a foreign capacity - rather than an "invalid capacity" or a bounds trap in the runtime, which reads like memory corruption to whoever sees it in a parser. This fixture exists so the guard cannot be dropped quietly: the harness runs it, requires a non-zero exit, and requires that exact text. The existing linkdata_fixed_length fixture pins the header (cap reports len, subslicing yields normal storage); this one pins the refusal. */ package main //:linkdata 16 fixturesymbol var local []byte func main() { select { case <-shutdown: return default: } // push on the package global is a compile error (a global is immutable // outside init), so take a local header copy: it keeps the foreign // capacity and reaches the runtime guard. l := local push(l, 1) println("push on a linkdata slice did not panic") }