Skip to content

Commit

Permalink
Implement string literals (without escapes)
Browse files Browse the repository at this point in the history
  • Loading branch information
osteele committed Jun 26, 2017
1 parent 803fbbc commit ed150c5
Show file tree
Hide file tree
Showing 3 changed files with 365 additions and 377 deletions.
26 changes: 14 additions & 12 deletions expressions/evaluator_test.go
Expand Up @@ -7,26 +7,17 @@ import (
"github.com/stretchr/testify/require"
)

var evaluatorTestContext = Context{map[string]interface{}{
"n": 123,
"ar": []string{"first", "second", "third"},
"obj": map[string]interface{}{
"a": "first",
"b": map[string]interface{}{"c": "d"},
"c": []string{"r", "g", "b"},
},
},
}

var evaluatorTests = []struct {
in string
expected interface{}
}{
// Constants
// Literals
{"12", 12},
{"12.3", 12.3},
{"true", true},
{"false", false},
{`'abc'`, "abc"},
{`"abc"`, "abc"},

// Variables
{"n", 123},
Expand Down Expand Up @@ -57,6 +48,17 @@ var evaluatorTests = []struct {
{"1.0 < 2", true},
}

var evaluatorTestContext = Context{map[string]interface{}{
"n": 123,
"ar": []string{"first", "second", "third"},
"obj": map[string]interface{}{
"a": "first",
"b": map[string]interface{}{"c": "d"},
"c": []string{"r", "g", "b"},
},
},
}

func TestEvaluator(t *testing.T) {
for i, test := range evaluatorTests {
t.Run(fmt.Sprint(i), func(t *testing.T) {
Expand Down

0 comments on commit ed150c5

Please sign in to comment.