~sircmpwn/hare-xml

c86eac33fc4c4496ae5284156018102bb0ea4c2c — Alexey Yerin 8 months ago 1524aef
Fix up tests using bufio

Oops

Signed-off-by: Alexey Yerin <yyp@disroot.org>
2 files changed, 3 insertions(+), 3 deletions(-)

M +test.ha
M parser.ha
M +test.ha => +test.ha +1 -2
@@ 83,8 83,7 @@ use strings;

fn xmltest(input: str, expected: []token, err: bool) void = {
	let in = bufio::fixed(strings::toutf8(input), io::mode::READ);
	defer io::close(in);
	let parser = parse(in) as *parser;
	let parser = parse(&in) as *parser;
	for (let i = 0z; i < len(expected); i += 1) {
		let tok = match (scan(parser)) {
		case let tok: token =>

M parser.ha => parser.ha +2 -1
@@ 22,6 22,7 @@ export fn parse(in: io::handle) (*parser | error) = {
	// stack is so that we have a consistent address for the bufio buffer.
	// This is kind of lame, maybe we can avoid that.
	let par = alloc(parser {
		in = null: *bufio::bufstream,
		close = false,
		namebuf = strio::dynamic(),
		entbuf = strio::dynamic(),


@@ 31,7 32,7 @@ export fn parse(in: io::handle) (*parser | error) = {
	if (bufio::isbuffered(in)) {
		par.in = in as *io::stream: *bufio::bufstream;
	} else {
		par.in = alloc(bufio::buffered(par.in, par.buf[..], []));
		par.in = alloc(bufio::buffered(in, par.buf[..], []));
		par.close = true;
	};
	prolog(par)?;