Added new special operators like &= and <<=.
Also made a litle change to scanner function moveOn(): now it moves on the last char passed and only if there are more than one chars.
This commit is contained in:
+15
-1
@@ -14,10 +14,24 @@ func TestOperator(t *testing.T) {
|
||||
/* 1 */ {`a=1; unset "a"; a`, nil, `undefined variable or function "a"`},
|
||||
/* 2 */ {`a=1; unset ["a", "b"]`, int64(1), nil},
|
||||
/* 3 */ {`f=func(){3}; unset "f()"`, int64(1), nil},
|
||||
/* 4 */ {`a=1; a<<=1+0`, int64(2), nil},
|
||||
/* 5 */ {`a=2; a>>=1+0`, int64(1), nil},
|
||||
/* 6 */ {`1<<1`, int64(2), nil},
|
||||
/* 7 */ {`1>>1`, int64(0), nil},
|
||||
/* 8 */ {`1|2`, int64(3), nil},
|
||||
/* 9 */ {`a=1; a|=2`, int64(3), nil},
|
||||
/* 10 */ {`3&1`, int64(1), nil},
|
||||
/* 11 */ {`a=3; a&=1`, int64(1), nil},
|
||||
/* 12 */ {`~1`, int64(-2), nil},
|
||||
/* 13 */ {`0x10`, int64(16), nil},
|
||||
/* 14 */ {`0x1X`, nil, `[1:5] two adjacent operators: "1" and "X"`},
|
||||
/* 15 */ {`0o10`, int64(8), nil},
|
||||
/* 16 */ {`0b10`, int64(2), nil},
|
||||
/* 17 */ {`~true`, nil, `[1:2] prefix/postfix operator "~" do not support operand 'true' [bool]`},
|
||||
}
|
||||
|
||||
// t.Setenv("EXPR_PATH", ".")
|
||||
|
||||
//runTestSuiteSpec(t, section, inputs, 3)
|
||||
// runTestSuiteSpec(t, section, inputs, 4)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user