<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/subexast_test.go
blob: 156162ed3961aa6d5515c6ac5177c017cea4a7f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package subex

import (
	"testing"
)

func expectASTEqual(t *testing.T, ast SubexAST, expected SubexAST) {
	if ast == expected {
		return
	}

	t.Fatalf("Expected %v, found %v", expected, ast)
}

func expectAST(t *testing.T, subex string, expected SubexAST) {
	lexer := NewStringRuneReader(subex)
	ast := Parse(lexer)
	expectASTEqual(t, ast, expected)
}