package parse

import (
	"testing"

	"git.makaay.nl/mauricem/go-parsekit/parse"
)

func TestStartBoolean(t *testing.T) {
	parser := newParser()
	wrapper := func(p *parse.API) { parser.parseBoolean(p) }
	testParse(t, parser, wrapper, parseTest{"INVALID", "{}", "unexpected input (expected true or false) at start of file"})
}

func TestBoolean(t *testing.T) {
	for _, test := range []parseTest{
		{`x=true`, `{"x": true}`, ``},
		{`x=false`, `{"x": false}`, ``},
		{`x=yes`, `{}`, `unexpected input (expected a value) at line 1, column 3`},
		{`x=no`, `{}`, `unexpected input (expected a value) at line 1, column 3`},
		{`x=1`, `{"x": 1}`, ``},
		{`x=0`, `{"x": 0}`, ``},
	} {
		p := newParser()
		testParse(t, p, p.startDocument, test)
	}
}
