add basic support for tuples
This commit is contained in:
parent
7bb277045c
commit
e03d18c7db
7 changed files with 339 additions and 18 deletions
|
|
@ -960,6 +960,31 @@ func TestParser_Parse(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestParser_AcceptAll(t *testing.T) {
|
||||
p := NewParser("a:", []string{}, []Token{
|
||||
NewToken(TokenName, 0, 1, 0, "a"),
|
||||
NewToken(TokenColon, 1, 2, 0, "a"),
|
||||
})
|
||||
|
||||
if !p.acceptAll(TokenName, TokenColon) {
|
||||
t.Fatalf("tokens were not accepted")
|
||||
}
|
||||
|
||||
t.Logf("tokens were accepted")
|
||||
}
|
||||
|
||||
func TestParser_AcceptAll_TooFew(t *testing.T) {
|
||||
p := NewParser("a", []string{}, []Token{
|
||||
NewToken(TokenName, 0, 1, 0, "a"),
|
||||
})
|
||||
|
||||
if p.acceptAll(TokenName, TokenColon) {
|
||||
t.Fatalf("tokens were incorrectly accepted")
|
||||
}
|
||||
|
||||
t.Logf("tokens were, as expected, not accepted")
|
||||
}
|
||||
|
||||
func BenchmarkParser_Parse(b *testing.B) {
|
||||
tokenData := GetTokenTestData()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue