2013-12-21 23:59:11 +00:00
|
|
|
/*
|
|
|
|
Copyright 2013 The Camlistore Authors
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package search
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"reflect"
|
|
|
|
"strings"
|
|
|
|
"testing"
|
2013-12-24 03:11:55 +00:00
|
|
|
|
|
|
|
"camlistore.org/pkg/context"
|
2013-12-21 23:59:11 +00:00
|
|
|
)
|
|
|
|
|
2014-03-17 19:07:08 +00:00
|
|
|
var skiphiddenC = &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
var ispanoC = &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "camliContent",
|
|
|
|
ValueInSet: &Constraint{
|
|
|
|
File: &FileConstraint{
|
|
|
|
IsImage: true,
|
|
|
|
WHRatio: &FloatConstraint{
|
|
|
|
Min: 2.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
var attrfoobarC = &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "foo",
|
|
|
|
Value: "bar",
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
var attrgorunC = &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "go",
|
|
|
|
Value: "run",
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2014-06-15 16:32:23 +00:00
|
|
|
var hasLocationC = orConst(&Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "camliContent",
|
|
|
|
ValueInSet: &Constraint{
|
|
|
|
File: &FileConstraint{
|
|
|
|
IsImage: true,
|
|
|
|
Location: &LocationConstraint{Any: true},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Location: &LocationConstraint{Any: true},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
var parseExpressionTests = []struct {
|
2014-03-17 19:07:08 +00:00
|
|
|
name string
|
|
|
|
in string
|
|
|
|
inList []string
|
|
|
|
want *SearchQuery
|
|
|
|
errContains string
|
2014-04-13 21:00:24 +00:00
|
|
|
ctx *context.Context
|
2014-03-17 19:07:08 +00:00
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "empty search",
|
|
|
|
inList: []string{"", " ", "\n"},
|
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: skiphiddenC,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "is:pano",
|
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: andConst(skiphiddenC, ispanoC),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
{
|
|
|
|
in: "is:pano)",
|
|
|
|
errContains: "No matching opening",
|
|
|
|
},
|
|
|
|
|
2013-12-23 03:26:49 +00:00
|
|
|
{
|
|
|
|
in: "width:0-640",
|
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: &Constraint{
|
|
|
|
Logical: &LogicalConstraint{
|
|
|
|
Op: "and",
|
2014-03-17 19:07:08 +00:00
|
|
|
A: skiphiddenC,
|
2013-12-23 03:26:49 +00:00
|
|
|
B: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "camliContent",
|
|
|
|
ValueInSet: &Constraint{
|
|
|
|
File: &FileConstraint{
|
|
|
|
IsImage: true,
|
|
|
|
Width: &IntConstraint{
|
|
|
|
ZeroMin: true,
|
|
|
|
Max: 640,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2014-03-07 21:27:40 +00:00
|
|
|
{
|
2014-03-14 02:01:55 +00:00
|
|
|
name: "tag with spaces",
|
|
|
|
in: `tag:"Foo Bar"`,
|
2014-03-07 21:27:40 +00:00
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: &Constraint{
|
|
|
|
Logical: &LogicalConstraint{
|
|
|
|
Op: "and",
|
2014-03-17 19:07:08 +00:00
|
|
|
A: skiphiddenC,
|
2014-03-07 21:27:40 +00:00
|
|
|
B: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "tag",
|
|
|
|
Value: "Foo Bar",
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-14 02:01:55 +00:00
|
|
|
name: "attribute search",
|
|
|
|
in: "attr:foo:bar",
|
2014-03-07 21:27:40 +00:00
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: &Constraint{
|
|
|
|
Logical: &LogicalConstraint{
|
|
|
|
Op: "and",
|
2014-03-17 19:07:08 +00:00
|
|
|
A: skiphiddenC,
|
2014-03-07 21:27:40 +00:00
|
|
|
B: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "foo",
|
|
|
|
Value: "bar",
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-14 02:01:55 +00:00
|
|
|
name: "attribute search with space in value",
|
|
|
|
in: `attr:foo:"fun bar"`,
|
2014-03-07 21:27:40 +00:00
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: &Constraint{
|
|
|
|
Logical: &LogicalConstraint{
|
|
|
|
Op: "and",
|
2014-03-17 19:07:08 +00:00
|
|
|
A: skiphiddenC,
|
2014-03-07 21:27:40 +00:00
|
|
|
B: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "foo",
|
|
|
|
Value: "fun bar",
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2013-12-21 23:59:11 +00:00
|
|
|
{
|
|
|
|
in: "tag:funny",
|
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: &Constraint{
|
2013-12-22 23:11:31 +00:00
|
|
|
Logical: &LogicalConstraint{
|
|
|
|
Op: "and",
|
2014-03-17 19:07:08 +00:00
|
|
|
A: skiphiddenC,
|
2013-12-22 23:11:31 +00:00
|
|
|
B: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "tag",
|
|
|
|
Value: "funny",
|
|
|
|
SkipHidden: true,
|
2014-01-11 01:35:09 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "title:Doggies",
|
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: &Constraint{
|
|
|
|
Logical: &LogicalConstraint{
|
|
|
|
Op: "and",
|
2014-03-17 19:07:08 +00:00
|
|
|
A: skiphiddenC,
|
2014-01-11 01:35:09 +00:00
|
|
|
B: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "title",
|
|
|
|
ValueMatches: &StringConstraint{
|
|
|
|
Contains: "Doggies",
|
|
|
|
CaseInsensitive: true,
|
|
|
|
},
|
|
|
|
SkipHidden: true,
|
2013-12-22 23:11:31 +00:00
|
|
|
},
|
|
|
|
},
|
2013-12-21 23:59:11 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2013-12-22 23:11:31 +00:00
|
|
|
|
2014-03-14 02:01:55 +00:00
|
|
|
{
|
|
|
|
in: "childrenof:sha1-f00ba4",
|
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: &Constraint{
|
|
|
|
Logical: &LogicalConstraint{
|
|
|
|
Op: "and",
|
2014-03-17 19:07:08 +00:00
|
|
|
A: skiphiddenC,
|
2014-03-14 02:01:55 +00:00
|
|
|
B: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Relation: &RelationConstraint{
|
|
|
|
Relation: "parent",
|
|
|
|
Any: &Constraint{
|
|
|
|
BlobRefPrefix: "sha1-f00ba4",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2014-04-13 21:00:24 +00:00
|
|
|
// Location predicates
|
|
|
|
{
|
|
|
|
in: "loc:Uitdam", // Small dutch town
|
|
|
|
want: &SearchQuery{
|
|
|
|
Constraint: andConst(skiphiddenC, orConst(&Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "camliContent",
|
|
|
|
ValueInSet: &Constraint{
|
|
|
|
File: &FileConstraint{
|
|
|
|
IsImage: true,
|
|
|
|
Location: uitdamLC,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Location: uitdamLC,
|
|
|
|
},
|
|
|
|
})),
|
|
|
|
},
|
|
|
|
ctx: newGeocodeContext(),
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "has:location",
|
|
|
|
want: &SearchQuery{
|
2014-06-15 16:32:23 +00:00
|
|
|
Constraint: andConst(skiphiddenC, hasLocationC),
|
2014-04-13 21:00:24 +00:00
|
|
|
},
|
|
|
|
},
|
2014-03-14 02:01:55 +00:00
|
|
|
|
2013-12-21 23:59:11 +00:00
|
|
|
// TODO: at least 'x' will go away eventually.
|
2013-12-22 23:11:31 +00:00
|
|
|
/*
|
|
|
|
{
|
|
|
|
inList: []string{"x", "bogus:operator"},
|
|
|
|
errContains: "unknown expression",
|
|
|
|
},
|
|
|
|
*/
|
2013-12-21 23:59:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParseExpression(t *testing.T) {
|
|
|
|
qj := func(sq *SearchQuery) []byte {
|
|
|
|
v, err := json.MarshalIndent(sq, "", " ")
|
|
|
|
if err != nil {
|
2014-04-13 21:00:24 +00:00
|
|
|
t.Fatal(err)
|
2013-12-21 23:59:11 +00:00
|
|
|
}
|
|
|
|
return v
|
|
|
|
}
|
2014-03-28 20:49:53 +00:00
|
|
|
for _, tt := range parseExpressionTests {
|
2013-12-21 23:59:11 +00:00
|
|
|
ins := tt.inList
|
|
|
|
if len(ins) == 0 {
|
|
|
|
ins = []string{tt.in}
|
|
|
|
}
|
|
|
|
for _, in := range ins {
|
2014-04-13 21:00:24 +00:00
|
|
|
ctx := tt.ctx
|
|
|
|
if ctx == nil {
|
|
|
|
ctx = context.TODO()
|
|
|
|
}
|
|
|
|
got, err := parseExpression(ctx, in)
|
2013-12-21 23:59:11 +00:00
|
|
|
if err != nil {
|
|
|
|
if tt.errContains != "" && strings.Contains(err.Error(), tt.errContains) {
|
|
|
|
continue
|
|
|
|
}
|
2014-03-17 19:07:08 +00:00
|
|
|
t.Errorf("%s: parseExpression(%q) error: %v", tt.name, in, err)
|
2013-12-21 23:59:11 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
if tt.errContains != "" {
|
2014-03-17 19:07:08 +00:00
|
|
|
t.Errorf("%s: parseExpression(%q) succeeded; want error containing %q", tt.name, in, tt.errContains)
|
2013-12-21 23:59:11 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
if !reflect.DeepEqual(got, tt.want) {
|
2014-03-17 19:07:08 +00:00
|
|
|
t.Errorf("%s: parseExpression(%q) got:\n%s\n\nwant:%s\n", tt.name, in, qj(got), qj(tt.want))
|
2013-12-21 23:59:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-01-25 19:04:02 +00:00
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
func doSticherChecking(name string, t *testing.T, tt sticherTestCase, got *Constraint, err error, p parser) {
|
|
|
|
ntt := parserTestCase{
|
|
|
|
name: tt.name,
|
|
|
|
in: tt.in,
|
|
|
|
want: tt.want,
|
|
|
|
remCount: tt.remCount,
|
|
|
|
errContains: tt.errContains,
|
|
|
|
}
|
|
|
|
doChecking(name, t, ntt, got, err, p)
|
|
|
|
}
|
|
|
|
|
|
|
|
func doChecking(name string, t *testing.T, tt parserTestCase, got *Constraint, err error, p parser) {
|
|
|
|
cj := func(c *Constraint) []byte {
|
|
|
|
v, err := json.MarshalIndent(c, "", " ")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
remain := func() []token {
|
|
|
|
var remainder []token
|
|
|
|
var i int
|
|
|
|
for i = 0; true; i++ {
|
|
|
|
token := p.next()
|
|
|
|
if token.typ == tokenEOF {
|
|
|
|
break
|
|
|
|
} else {
|
|
|
|
remainder = append(remainder, *token)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return remainder
|
|
|
|
}
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
if tt.errContains != "" && strings.Contains(err.Error(), tt.errContains) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if tt.errContains != "" {
|
|
|
|
t.Errorf("%s: %s(%q) error: %v, but wanted an error with: %v", tt.name, name, tt.in, err, tt.errContains)
|
|
|
|
} else {
|
|
|
|
t.Errorf("%s: %s(%q) unexpected error: %v", tt.name, name, tt.in, err)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if tt.errContains != "" {
|
|
|
|
t.Errorf("%s: %s(%q) succeeded; want error containing %q got: %s", tt.name, name, tt.in, tt.errContains, cj(got))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if !reflect.DeepEqual(got, tt.want) {
|
|
|
|
t.Errorf("%s: %s(%q) got:\n%s\n\nwant:%s\n", tt.name, name, tt.in, cj(got), cj(tt.want))
|
|
|
|
}
|
|
|
|
remainder := remain()
|
|
|
|
if len(remainder) != tt.remCount {
|
|
|
|
t.Errorf("%s: %s(%s): Expected remainder of %d got %d\nRemaining tokens: %#v", tt.name, name, tt.in, tt.remCount, len(remainder), remainder)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type parserTestCase struct {
|
2014-03-17 19:07:08 +00:00
|
|
|
name string
|
2014-03-28 20:49:53 +00:00
|
|
|
in string
|
2014-03-17 19:07:08 +00:00
|
|
|
want *Constraint
|
|
|
|
remCount int
|
|
|
|
errContains string
|
2014-03-28 20:49:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type sticherTestCase struct {
|
|
|
|
name string
|
|
|
|
in string
|
|
|
|
want *Constraint
|
|
|
|
remCount int
|
|
|
|
errContains string
|
|
|
|
lhs *Constraint
|
|
|
|
}
|
|
|
|
|
|
|
|
var parseOrRHSTests = []sticherTestCase{
|
2014-03-17 19:07:08 +00:00
|
|
|
{
|
|
|
|
name: "stop on )",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano )",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: orConst(nil, ispanoC),
|
|
|
|
remCount: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano and attr:foo:bar",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: orConst(nil, andConst(ispanoC, attrfoobarC)),
|
|
|
|
remCount: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "add atom",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: orConst(nil, ispanoC),
|
|
|
|
remCount: 0,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
func TestParseOrRhs(t *testing.T) {
|
|
|
|
for _, tt := range parseOrRHSTests {
|
|
|
|
p := newParser(tt.in)
|
|
|
|
|
|
|
|
got, err := p.parseOrRHS(context.TODO(), tt.lhs)
|
|
|
|
|
|
|
|
doSticherChecking("parseOrRHS", t, tt, got, err, p)
|
2014-03-17 19:07:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
var parseAndRHSTests = []sticherTestCase{
|
2014-03-17 19:07:08 +00:00
|
|
|
{
|
|
|
|
name: "stop on )",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano )",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: andConst(nil, ispanoC),
|
|
|
|
remCount: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "stop on or",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano or",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: andConst(nil, ispanoC),
|
|
|
|
remCount: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "add atom",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: andConst(nil, ispanoC),
|
|
|
|
remCount: 0,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestParseConjuction(t *testing.T) {
|
2014-03-28 20:49:53 +00:00
|
|
|
for _, tt := range parseAndRHSTests {
|
|
|
|
p := newParser(tt.in)
|
|
|
|
|
|
|
|
got, err := p.parseAndRHS(context.TODO(), tt.lhs)
|
|
|
|
|
|
|
|
doSticherChecking("parseAndRHS", t, tt, got, err, p)
|
2014-03-17 19:07:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var parseGroupTests = []struct {
|
|
|
|
name string
|
2014-03-28 20:49:53 +00:00
|
|
|
in string
|
2014-03-17 19:07:08 +00:00
|
|
|
want *Constraint
|
|
|
|
remCount int
|
|
|
|
errContains string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "simple grouped atom",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "( is:pano )",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: ispanoC,
|
|
|
|
remCount: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "simple grouped or with remainder",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "( attr:foo:bar or is:pano ) attr:foo:bar",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: orConst(attrfoobarC, ispanoC),
|
2014-03-28 20:49:53 +00:00
|
|
|
remCount: 5,
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "simple grouped and with remainder",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "( attr:foo:bar is:pano ) attr:foo:bar",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: andConst(attrfoobarC, ispanoC),
|
2014-03-28 20:49:53 +00:00
|
|
|
remCount: 5,
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "simple grouped atom with remainder",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "( is:pano ) attr:foo:bar",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: ispanoC,
|
2014-03-28 20:49:53 +00:00
|
|
|
remCount: 5,
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestParseGroup(t *testing.T) {
|
|
|
|
for _, tt := range parseGroupTests {
|
2014-03-28 20:49:53 +00:00
|
|
|
p := newParser(tt.in)
|
|
|
|
|
|
|
|
got, err := p.parseGroup(context.TODO())
|
|
|
|
|
|
|
|
doChecking("parseGroup", t, tt, got, err, p)
|
2014-03-17 19:07:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var parseOperandTests = []struct {
|
|
|
|
name string
|
2014-03-28 20:49:53 +00:00
|
|
|
in string
|
2014-03-17 19:07:08 +00:00
|
|
|
want *Constraint
|
|
|
|
remCount int
|
|
|
|
errContains string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "group of one atom",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "( is:pano )",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: ispanoC,
|
|
|
|
remCount: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "one atom",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: ispanoC,
|
|
|
|
remCount: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "two atoms",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano attr:foo:bar",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: ispanoC,
|
2014-03-28 20:49:53 +00:00
|
|
|
remCount: 5,
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "grouped atom and atom",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "( is:pano ) attr:foo:bar",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: ispanoC,
|
2014-03-28 20:49:53 +00:00
|
|
|
remCount: 5,
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "atom and )",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano )",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: ispanoC,
|
|
|
|
remCount: 1,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestParseOperand(t *testing.T) {
|
|
|
|
for _, tt := range parseOperandTests {
|
2014-03-28 20:49:53 +00:00
|
|
|
p := newParser(tt.in)
|
|
|
|
|
|
|
|
got, err := p.parseOperand(context.TODO())
|
|
|
|
|
|
|
|
doChecking("parseOperand", t, tt, got, err, p)
|
2014-03-17 19:07:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
var parseExpTests = []parserTestCase{
|
2014-04-13 21:00:24 +00:00
|
|
|
{
|
|
|
|
in: "attr:foo:",
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
2014-06-20 20:55:43 +00:00
|
|
|
Attr: "foo",
|
|
|
|
ValueMatches: &StringConstraint{Empty: true},
|
|
|
|
SkipHidden: true,
|
2014-04-13 21:00:24 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "after:foo",
|
|
|
|
errContains: "as \"2006\" at position 0",
|
|
|
|
},
|
|
|
|
|
2014-05-23 18:01:26 +00:00
|
|
|
{
|
|
|
|
in: "after:foo:bar",
|
|
|
|
errContains: `Wrong number of arguments for "after", given 2, expected 1 at position 0, token: "after:foo:bar"`,
|
|
|
|
},
|
|
|
|
|
2014-04-13 21:00:24 +00:00
|
|
|
{
|
|
|
|
in: " attr:foo",
|
2014-05-23 18:01:26 +00:00
|
|
|
errContains: `Wrong number of arguments for "attr", given 1, expected 2 at position 5, token: "attr:foo"`,
|
2014-04-13 21:00:24 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-06-15 16:32:23 +00:00
|
|
|
in: "has:location",
|
|
|
|
want: hasLocationC,
|
2014-04-13 21:00:24 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "is:pano",
|
|
|
|
want: ispanoC,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "height:0-640",
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "camliContent",
|
|
|
|
ValueInSet: &Constraint{
|
|
|
|
File: &FileConstraint{
|
|
|
|
IsImage: true,
|
|
|
|
Height: &IntConstraint{
|
|
|
|
ZeroMin: true,
|
|
|
|
Max: 640,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "width:0-640",
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "camliContent",
|
|
|
|
ValueInSet: &Constraint{
|
|
|
|
File: &FileConstraint{
|
|
|
|
IsImage: true,
|
|
|
|
Width: &IntConstraint{
|
|
|
|
ZeroMin: true,
|
|
|
|
Max: 640,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "height:++0",
|
|
|
|
errContains: "Unable to parse \"++0\" as range, wanted something like 480-1024, 480-, -1024 or 1024 at position 0",
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "height:480",
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "camliContent",
|
|
|
|
ValueInSet: &Constraint{
|
|
|
|
File: &FileConstraint{
|
|
|
|
IsImage: true,
|
|
|
|
Height: &IntConstraint{
|
|
|
|
Min: 480,
|
|
|
|
Max: 480,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "width:++0",
|
|
|
|
errContains: "Unable to parse \"++0\" as range, wanted something like 480-1024, 480-, -1024 or 1024 at position 0",
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "width:640",
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "camliContent",
|
|
|
|
ValueInSet: &Constraint{
|
|
|
|
File: &FileConstraint{
|
|
|
|
IsImage: true,
|
|
|
|
Width: &IntConstraint{
|
|
|
|
Min: 640,
|
|
|
|
Max: 640,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "tag with spaces",
|
|
|
|
in: `tag:"Foo Bar"`,
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "tag",
|
|
|
|
Value: "Foo Bar",
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "attribute search",
|
|
|
|
in: "attr:foo:bar",
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "foo",
|
|
|
|
Value: "bar",
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "attribute search with space in value",
|
|
|
|
in: `attr:foo:"fun bar"`,
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "foo",
|
|
|
|
Value: "fun bar",
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "tag:funny",
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "tag",
|
|
|
|
Value: "funny",
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "title:Doggies",
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Attr: "title",
|
|
|
|
ValueMatches: &StringConstraint{
|
|
|
|
Contains: "Doggies",
|
|
|
|
CaseInsensitive: true,
|
|
|
|
},
|
|
|
|
SkipHidden: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
in: "childrenof:sha1-f00ba4",
|
|
|
|
want: &Constraint{
|
|
|
|
Permanode: &PermanodeConstraint{
|
|
|
|
Relation: &RelationConstraint{
|
|
|
|
Relation: "parent",
|
|
|
|
Any: &Constraint{
|
|
|
|
BlobRefPrefix: "sha1-f00ba4",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
{
|
|
|
|
name: "Unmatched quote",
|
|
|
|
in: `is:pano and "foo`,
|
|
|
|
errContains: "Unclosed quote at position 12",
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "Unmatched quote",
|
|
|
|
in: `"foo`,
|
|
|
|
errContains: "Unclosed quote at position 0",
|
|
|
|
},
|
|
|
|
|
2014-03-17 19:07:08 +00:00
|
|
|
{
|
|
|
|
name: "Unmatched (",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "(",
|
|
|
|
errContains: "No matching closing parenthesis at position 0",
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "Unmatched )",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: ")",
|
2014-03-17 19:07:08 +00:00
|
|
|
errContains: "No matching opening parenthesis",
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "Unmatched ) at the end ",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano or attr:foo:bar )",
|
2014-03-17 19:07:08 +00:00
|
|
|
want: orConst(ispanoC, attrfoobarC),
|
|
|
|
remCount: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "empty search",
|
|
|
|
in: "",
|
|
|
|
want: nil,
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "faulty negation in 'or'",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano - or - is:pano",
|
|
|
|
errContains: "at position 10",
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "faulty negation in 'or'",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano or -",
|
2014-03-17 19:07:08 +00:00
|
|
|
errContains: "an atom",
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "faulty disjunction, empty right",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "is:pano or",
|
|
|
|
errContains: "at position 8",
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "faulty disjunction",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "or is:pano",
|
|
|
|
errContains: "at position 0",
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "faulty conjunction",
|
2014-03-28 20:49:53 +00:00
|
|
|
in: "and is:pano",
|
|
|
|
errContains: "at position 0",
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "one atom",
|
|
|
|
in: "is:pano",
|
|
|
|
want: ispanoC,
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "negated atom",
|
|
|
|
in: "- is:pano",
|
|
|
|
want: notConst(ispanoC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "double negated atom",
|
|
|
|
in: "- - is:pano",
|
|
|
|
want: ispanoC,
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "parenthesized atom with implicit 'and' and other atom",
|
|
|
|
in: "( is:pano ) attr:foo:bar",
|
|
|
|
want: andConst(ispanoC, attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "negated implicit 'and'",
|
|
|
|
in: "- ( is:pano attr:foo:bar )",
|
|
|
|
want: notConst(andConst(ispanoC, attrfoobarC)),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "negated implicit 'and' with trailing attr:go:run",
|
|
|
|
in: "- ( is:pano attr:foo:bar ) attr:go:run",
|
|
|
|
want: andConst(notConst(andConst(ispanoC, attrfoobarC)), attrgorunC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "parenthesized implicit 'and'",
|
|
|
|
in: "( is:pano attr:foo:bar )",
|
|
|
|
want: andConst(ispanoC, attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "simple 'or' of two atoms",
|
|
|
|
in: "is:pano or attr:foo:bar",
|
|
|
|
want: orConst(ispanoC, attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "left associativity of implicit 'and'",
|
|
|
|
in: "is:pano attr:go:run attr:foo:bar",
|
|
|
|
want: andConst(andConst(ispanoC, attrgorunC), attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "left associativity of explicit 'and'",
|
|
|
|
in: "is:pano and attr:go:run and attr:foo:bar",
|
|
|
|
want: andConst(andConst(ispanoC, attrgorunC), attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "left associativity of 'or'",
|
|
|
|
in: "is:pano or attr:go:run or attr:foo:bar",
|
|
|
|
want: orConst(orConst(ispanoC, attrgorunC), attrfoobarC)},
|
2014-03-17 19:07:08 +00:00
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "left associativity of 'or' with negated atom",
|
|
|
|
in: "is:pano or - attr:go:run or attr:foo:bar",
|
|
|
|
want: orConst(orConst(ispanoC, notConst(attrgorunC)), attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "left associativity of 'or' with double negated atom",
|
|
|
|
in: "is:pano or - - attr:go:run or attr:foo:bar",
|
|
|
|
want: orConst(orConst(ispanoC, attrgorunC), attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "left associativity of 'or' with parenthesized subexpression",
|
|
|
|
in: "is:pano or ( - attr:go:run ) or attr:foo:bar",
|
|
|
|
want: orConst(orConst(ispanoC, notConst(attrgorunC)), attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "explicit 'and' of two atoms",
|
|
|
|
in: "is:pano and attr:foo:bar",
|
|
|
|
want: andConst(ispanoC, attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "implicit 'and' of two atom",
|
|
|
|
in: "is:pano attr:foo:bar",
|
|
|
|
want: andConst(ispanoC, attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "grouping an 'and' in an 'or'",
|
|
|
|
in: "is:pano or ( attr:foo:bar attr:go:run )",
|
|
|
|
want: orConst(ispanoC, andConst(attrfoobarC, attrgorunC)),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "precedence of 'and' over 'or'",
|
|
|
|
in: "is:pano or attr:foo:bar and attr:go:run",
|
|
|
|
want: orConst(ispanoC, andConst(attrfoobarC, attrgorunC)),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "precedence of 'and' over 'or' with 'and' on the left",
|
|
|
|
in: "is:pano and attr:foo:bar or attr:go:run",
|
|
|
|
want: orConst(andConst(ispanoC, attrfoobarC), attrgorunC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "precedence of 'and' over 'or' with 'and' on the left and right",
|
|
|
|
in: "is:pano and attr:foo:bar or attr:go:run is:pano",
|
|
|
|
want: orConst(andConst(ispanoC, attrfoobarC), andConst(attrgorunC, ispanoC)),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "precedence of 'and' over 'or' with 'and' on the left and right with a negation",
|
|
|
|
in: "is:pano and attr:foo:bar or - attr:go:run is:pano",
|
|
|
|
want: orConst(andConst(ispanoC, attrfoobarC), andConst(notConst(attrgorunC), ispanoC)),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "precedence of 'and' over 'or' with 'and' on the left and right with a negation of group and trailing 'and'",
|
|
|
|
in: "is:pano and attr:foo:bar or - ( attr:go:run is:pano ) is:pano",
|
|
|
|
want: orConst(andConst(ispanoC, attrfoobarC), andConst(notConst(andConst(attrgorunC, ispanoC)), ispanoC)),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "complicated",
|
|
|
|
in: "- ( is:pano and attr:foo:bar ) or - ( attr:go:run is:pano ) is:pano",
|
|
|
|
want: orConst(notConst(andConst(ispanoC, attrfoobarC)), andConst(notConst(andConst(attrgorunC, ispanoC)), ispanoC)),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "complicated",
|
|
|
|
in: "is:pano or attr:foo:bar attr:go:run or - attr:go:run or is:pano is:pano",
|
|
|
|
want: orConst(orConst(orConst(ispanoC, andConst(attrfoobarC, attrgorunC)), notConst(attrgorunC)), andConst(ispanoC, ispanoC)),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2014-03-28 20:49:53 +00:00
|
|
|
name: "complicated",
|
|
|
|
in: "is:pano or attr:foo:bar attr:go:run or - attr:go:run or is:pano is:pano or attr:foo:bar",
|
|
|
|
want: orConst(orConst(orConst(orConst(ispanoC, andConst(attrfoobarC, attrgorunC)), notConst(attrgorunC)), andConst(ispanoC, ispanoC)), attrfoobarC),
|
2014-03-17 19:07:08 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
func TestParseExp(t *testing.T) {
|
|
|
|
for _, tt := range parseExpTests {
|
|
|
|
p := newParser(tt.in)
|
2014-03-17 19:07:08 +00:00
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
got, err := p.parseExp(context.TODO())
|
2014-01-25 19:04:02 +00:00
|
|
|
|
2014-03-28 20:49:53 +00:00
|
|
|
doChecking("parseExp", t, tt, got, err, p)
|
2014-03-17 19:07:08 +00:00
|
|
|
}
|
|
|
|
}
|