bufio: make scanning bounded and incremental
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
package bufio_test;
|
||||
|
||||
import bufio;
|
||||
import errors;
|
||||
import io;
|
||||
import memio;
|
||||
|
||||
@@ -415,7 +416,7 @@ fn checkpartialflush(zero: bool) void = {
|
||||
let sbuf: [32]u8;
|
||||
let sc: bufio.scanner = bufio.newscannerbuf(p, sbuf[0:32]);
|
||||
|
||||
let lr: (str | io.eof | io.error | bufio.overflow) = bufio.scanline(&sc);
|
||||
let lr: (str | io.eof | io.error | errors.overflow) = bufio.scanline(&sc);
|
||||
match (lr) {
|
||||
case let v: str => {
|
||||
assert(!(v.len != 8)); // "XYZhello"
|
||||
@@ -424,7 +425,7 @@ fn checkpartialflush(zero: bool) void = {
|
||||
};
|
||||
case io.eof => abort();
|
||||
case let e: io.error => abort();
|
||||
case bufio.overflow => abort();
|
||||
case errors.overflow => abort();
|
||||
};
|
||||
bufio.finish(&sc);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user