parser: now checks whether the assign operator '=' is preceded by a variable
This commit is contained in:
@@ -128,6 +128,9 @@ func TestParser(t *testing.T) {
|
||||
/* 101 */ {`false or (x==2)`, nil, errors.New(`undefined variable "x"`)},
|
||||
/* 102 */ {`a=5; a`, int64(5), nil},
|
||||
/* 103 */ {`a=5; b=2; add(a, b*3)`, int64(11), nil},
|
||||
/* 104 */ {`2=5`, nil, errors.New(`assign operator ("=") must be preceded by a variable`)},
|
||||
/* 105 */ {`2+a=5`, nil, errors.New(`left operand of "=" must be a variable`)},
|
||||
/* 106 */ {`2+(a=5)`, int64(7), nil},
|
||||
}
|
||||
succeeded := 0
|
||||
failed := 0
|
||||
|
||||
Reference in New Issue
Block a user