commit
e3ac00a5aa
|
@ -98,7 +98,7 @@ func TestFold(t *testing.T) {
|
|||
{`foo(bar(2 + 3), 4)`, `foo(bar(5.000), 4.000)`},
|
||||
{`4 / 0`, `0.000`},
|
||||
{`4 = 4`, `true`},
|
||||
{`4 != 4`, `false`},
|
||||
{`4 <> 4`, `false`},
|
||||
{`6 > 4`, `true`},
|
||||
{`4 >= 4`, `true`},
|
||||
{`4 < 6`, `true`},
|
||||
|
@ -109,7 +109,7 @@ func TestFold(t *testing.T) {
|
|||
{`true AND false`, `false`},
|
||||
{`true OR false`, `true`},
|
||||
{`true = false`, `false`},
|
||||
{`true != false`, `true`},
|
||||
{`true <> false`, `true`},
|
||||
{`true + false`, `true + false`},
|
||||
|
||||
// Time literals.
|
||||
|
@ -117,7 +117,7 @@ func TestFold(t *testing.T) {
|
|||
{`now() / 2h`, `"2000-01-01 00:00:00" / 2h`},
|
||||
{`4µ + now()`, `"2000-01-01 00:00:00.000004"`},
|
||||
{`now() = now()`, `true`},
|
||||
{`now() != now()`, `false`},
|
||||
{`now() <> now()`, `false`},
|
||||
{`now() < now() + 1h`, `true`},
|
||||
{`now() <= now() + 1h`, `true`},
|
||||
{`now() >= now() - 1h`, `true`},
|
||||
|
@ -129,7 +129,7 @@ func TestFold(t *testing.T) {
|
|||
{`10m + 1h - 60s`, `69m`},
|
||||
{`(10m / 2) * 5`, `25m`},
|
||||
{`60s = 1m`, `true`},
|
||||
{`60s != 1m`, `false`},
|
||||
{`60s <> 1m`, `false`},
|
||||
{`60s < 1h`, `true`},
|
||||
{`60s <= 1h`, `true`},
|
||||
{`60s > 12s`, `true`},
|
||||
|
|
|
@ -50,12 +50,6 @@ func (s *Scanner) Scan() (tok Token, pos Pos, lit string) {
|
|||
return DIV, pos, ""
|
||||
case '=':
|
||||
return EQ, pos, ""
|
||||
case '!':
|
||||
if ch1, _ := s.r.read(); ch1 == '=' {
|
||||
return NEQ, pos, ""
|
||||
}
|
||||
s.r.unread()
|
||||
return ILLEGAL, pos, string(ch0)
|
||||
case '>':
|
||||
if ch1, _ := s.r.read(); ch1 == '=' {
|
||||
return GTE, pos, ""
|
||||
|
@ -65,6 +59,8 @@ func (s *Scanner) Scan() (tok Token, pos Pos, lit string) {
|
|||
case '<':
|
||||
if ch1, _ := s.r.read(); ch1 == '=' {
|
||||
return LTE, pos, ""
|
||||
} else if ch1 == '>' {
|
||||
return NEQ, pos, ""
|
||||
}
|
||||
s.r.unread()
|
||||
return LT, pos, ""
|
||||
|
|
|
@ -42,7 +42,7 @@ func TestScanner_Scan(t *testing.T) {
|
|||
{s: `or`, tok: influxql.OR},
|
||||
|
||||
{s: `=`, tok: influxql.EQ},
|
||||
{s: `!=`, tok: influxql.NEQ},
|
||||
{s: `<>`, tok: influxql.NEQ},
|
||||
{s: `! `, tok: influxql.ILLEGAL, lit: "!"},
|
||||
{s: `<`, tok: influxql.LT},
|
||||
{s: `<=`, tok: influxql.LTE},
|
||||
|
|
Loading…
Reference in New Issue