Merge pull request #2804 from nvcook42/master

Time literals should use single quotes in String representation
pull/2902/head
Paul Dix 2015-06-10 21:09:21 -07:00
commit a2488ab8a5
2 changed files with 5 additions and 5 deletions

View File

@ -2113,7 +2113,7 @@ type TimeLiteral struct {
// String returns a string representation of the literal.
func (l *TimeLiteral) String() string {
return `"` + l.Val.UTC().Format(DateTimeFormat) + `"`
return `'` + l.Val.UTC().Format(DateTimeFormat) + `'`
}
// DurationLiteral represents a duration literal.

View File

@ -655,9 +655,9 @@ func TestReduce(t *testing.T) {
{in: `true + false`, out: `true + false`},
// Time literals.
{in: `now() + 2h`, out: `"2000-01-01 02:00:00"`, data: map[string]interface{}{"now()": now}},
{in: `now() / 2h`, out: `"2000-01-01 00:00:00" / 2h`, data: map[string]interface{}{"now()": now}},
{in: `4µ + now()`, out: `"2000-01-01 00:00:00.000004"`, data: map[string]interface{}{"now()": now}},
{in: `now() + 2h`, out: `'2000-01-01 02:00:00'`, data: map[string]interface{}{"now()": now}},
{in: `now() / 2h`, out: `'2000-01-01 00:00:00' / 2h`, data: map[string]interface{}{"now()": now}},
{in: `4µ + now()`, out: `'2000-01-01 00:00:00.000004'`, data: map[string]interface{}{"now()": now}},
{in: `now() = now()`, out: `true`, data: map[string]interface{}{"now()": now}},
{in: `now() <> now()`, out: `false`, data: map[string]interface{}{"now()": now}},
{in: `now() < now() + 1h`, out: `true`, data: map[string]interface{}{"now()": now}},
@ -665,7 +665,7 @@ func TestReduce(t *testing.T) {
{in: `now() >= now() - 1h`, out: `true`, data: map[string]interface{}{"now()": now}},
{in: `now() > now() - 1h`, out: `true`, data: map[string]interface{}{"now()": now}},
{in: `now() - (now() - 60s)`, out: `1m`, data: map[string]interface{}{"now()": now}},
{in: `now() AND now()`, out: `"2000-01-01 00:00:00" AND "2000-01-01 00:00:00"`, data: map[string]interface{}{"now()": now}},
{in: `now() AND now()`, out: `'2000-01-01 00:00:00' AND '2000-01-01 00:00:00'`, data: map[string]interface{}{"now()": now}},
{in: `now()`, out: `now()`},
// Duration literals.