summaryrefslogtreecommitdiff
path: root/debug/frames_test.go
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-10 21:04:14 +1000
committerAdam Scarr <adam@vektah.net>2017-08-10 21:08:18 +1000
commitaf542eff9e1e51561a9efa37685ee07b1d01b53e (patch)
treec700bdca58b4f9bbeb89ba1b102b2a779c88f7f3 /debug/frames_test.go
parentb64fcfaa6115eb4a5f65c12d37f95d842136ae35 (diff)
Add parse logging
Diffstat (limited to 'debug/frames_test.go')
-rw-r--r--debug/frames_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/debug/frames_test.go b/debug/frames_test.go
new file mode 100644
index 0000000..40c1086
--- /dev/null
+++ b/debug/frames_test.go
@@ -0,0 +1,24 @@
+package debug
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func TestRegex(t *testing.T) {
+ tests := map[string]string{
+ "attrs": ` attrs = Map(Some(attr), func(node Result) Result {`,
+ "_value": ` _value = Any(_null, _true, _false, _string, _number, _array, _object)`,
+ "_object": `_object = Map(Seq("{", Cut, _properties, "}"), func(n Result) Result {`,
+ "expr": `var expr = Exact("foo")`,
+ "number": `number := NumberLit()`,
+ }
+ for expected, input := range tests {
+ t.Run(input, func(t *testing.T) {
+ matches := varRegex.FindStringSubmatch(input)
+ require.NotNil(t, matches)
+ require.Equal(t, expected, matches[1])
+ })
+ }
+}