Files
ww/test/wcc/data/r778_branched_bufio_wrap/case.ww
Hojun-Cho d456263f7e test/wcc/data: grow the declarative compiler corpus to 1,224 fixtures
The r-prefixed waves absorb the runtime, reject, and byte-compare rows
of the migrated native carriers; each fixture is one directory with one
case.ww and a //ww:error, //ww:compile, //ww:run, or //ww:run-exit
directive covering both frontends.
2026-08-07 23:21:04 +09:00

30 lines
910 B
Plaintext

//ww:run-exit 51
// Migrated from 778_bufio_vstream_run row branched_bufio_wrap.
package main;
import os;
import bufio;
import memio;
import io;
export fn main() i32 = {
let raA: [4]u8;
raA[0] = 10u8; raA[1] = 11u8; raA[2] = 12u8; raA[3] = 13u8;
let raB: [4]u8;
raB[0] = 20u8; raB[1] = 21u8; raB[2] = 22u8; raB[3] = 23u8;
let mstA: memio.stream = memio.fixed(raA[0:4]);
let mstB: memio.stream = memio.fixed(raB[0:4]);
let sel: i32 = 1;
let src: io.stream = &mstA.vt;
if (sel == 0) { src = &mstB.vt; };
let rbuf: [4]u8;
let wbuf: [4]u8;
let bc: bufio.stream = bufio.init(src, rbuf[0:4], wbuf[0:4]);
let vs: io.stream = &bc.vt;
let out: [4]u8;
let rd = io.read(vs, out[0:4]);
let n: size = 0;
if (rd is size) { n = rd as size; };
if (n != 4: size) { return 91; };
if (out[0] != 10u8 || out[3] != 13u8) { return 92; };
return 51;
};