Files
ww/test/wcc/data/r778_stream_write_flush/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
911 B
Plaintext

//ww:run-exit 46
// Migrated from 778_bufio_vstream_run row stream_write_flush.
package main;
import os;
import bufio;
import memio;
import io;
export fn main() i32 = {
let raw: [16]u8;
let mst: memio.stream = memio.fixed(raw[0:16]);
let msrc: io.stream = &mst.vt;
let rbuf: [8]u8;
let wbuf: [8]u8;
let b: bufio.stream = bufio.init(msrc, rbuf[0:8], wbuf[0:8]);
let vs: io.stream = &b.vt;
let payload: [5]u8;
payload[0] = 104u8; payload[1] = 105u8;
payload[2] = 33u8; payload[3] = 98u8; payload[4] = 121u8;
let wr = io.write(vs, payload[0:5]);
let nw: size = 0;
if (wr is size) { nw = wr as size; };
if (mst.pos != 0) { return 91; };
let cl = io.close(vs);
if (cl is io.error) { return 92; };
if (mst.pos != 5) { return 93; };
if (nw != 5: size) { return 94; };
if (raw[0] != 104u8 || raw[4] != 121u8) { return 95; };
return 46;
};