parseExpr less allocation
diff --git a/rule_parser_test.go b/rule_parser_test.go
index 4adf912..5dc8f24 100644
--- a/rule_parser_test.go
+++ b/rule_parser_test.go
@@ -19,14 +19,6 @@
"testing"
)
-func parseExprForTest(e string) Value {
- v, _, err := parseExpr([]byte(e), nil)
- if err != nil {
- panic(err)
- }
- return v
-}
-
func TestRuleParser(t *testing.T) {
for _, tc := range []struct {
in string
@@ -109,8 +101,8 @@
outputs: []string{"foo"},
},
assign: &AssignAST{
- lhs: parseExprForTest("CFLAGS"),
- rhs: parseExprForTest("-g"),
+ lhs: literal("CFLAGS"),
+ rhs: literal("-g"),
op: "=",
},
},
@@ -120,8 +112,8 @@
outputs: []string{"foo"},
},
assign: &AssignAST{
- lhs: parseExprForTest("CFLAGS"),
- rhs: parseExprForTest("-g"),
+ lhs: literal("CFLAGS"),
+ rhs: literal("-g"),
op: "=",
},
},
@@ -131,8 +123,8 @@
outputs: []string{"foo"},
},
assign: &AssignAST{
- lhs: parseExprForTest("CFLAGS"),
- rhs: parseExprForTest("-g"),
+ lhs: literal("CFLAGS"),
+ rhs: literal("-g"),
op: ":=",
},
},
@@ -142,8 +134,8 @@
outputPatterns: []pattern{pattern{suffix: ".o"}},
},
assign: &AssignAST{
- lhs: parseExprForTest("CFLAGS"),
- rhs: parseExprForTest("-g"),
+ lhs: literal("CFLAGS"),
+ rhs: literal("-g"),
op: ":=",
},
},