summaryrefslogtreecommitdiff
path: root/androidmk/parser/parser_test.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2022-03-16 13:42:34 -0700
committer Cole Faust <colefaust@google.com> 2022-03-17 17:15:12 -0700
commite309a91ca8d088a60bc7335f4688cc6e8a81b04f (patch)
tree7ef9e3523858ea769b7ee8f9919aee3db3acdf29 /androidmk/parser/parser_test.go
parent23162405475f5b5d1facce9f9f7d22ba39066ff0 (diff)
Parse variable references with #s
Inside a variable reference, a # does not start a comment. Fixes: 218742602 Test: go test Change-Id: I16cf04c74a8aa30482fd9293175f893e4efb60f1
Diffstat (limited to 'androidmk/parser/parser_test.go')
-rw-r--r--androidmk/parser/parser_test.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/androidmk/parser/parser_test.go b/androidmk/parser/parser_test.go
index f562c29e8..9efebf8e1 100644
--- a/androidmk/parser/parser_test.go
+++ b/androidmk/parser/parser_test.go
@@ -34,6 +34,56 @@ var parserTestCases = []struct {
},
},
},
+ {
+ name: "Simple warning",
+ in: `$(warning A warning)`,
+ out: []Node{
+ &Variable{
+ Name: SimpleMakeString("warning A warning", NoPos),
+ },
+ },
+ },
+ {
+ name: "Warning with #",
+ in: `$(warning # A warning)`,
+ out: []Node{
+ &Variable{
+ Name: SimpleMakeString("warning # A warning", NoPos),
+ },
+ },
+ },
+ {
+ name: "Findstring with #",
+ in: `$(findstring x,x a #)`,
+ out: []Node{
+ &Variable{
+ Name: SimpleMakeString("findstring x,x a #", NoPos),
+ },
+ },
+ },
+ {
+ name: "If statement",
+ in: `ifeq (a,b) # comment
+endif`,
+ out: []Node{
+ &Directive{
+ NamePos: NoPos,
+ Name: "ifeq",
+ Args: SimpleMakeString("(a,b) ", NoPos),
+ EndPos: NoPos,
+ },
+ &Comment{
+ CommentPos: NoPos,
+ Comment: " comment",
+ },
+ &Directive{
+ NamePos: NoPos,
+ Name: "endif",
+ Args: SimpleMakeString("", NoPos),
+ EndPos: NoPos,
+ },
+ },
+ },
}
func TestParse(t *testing.T) {