MCPcopy
hub / github.com/perkeep/perkeep / TestQueryChildren

Function TestQueryChildren

pkg/search/query_test.go:1438–1470  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1436}
1437
1438func TestQueryChildren(t *testing.T) {
1439 testQueryTypes(t, memIndexTypes, func(qt *queryTest) {
1440 id := qt.id
1441
1442 pdir := id.NewPlannedPermanode("some_dir")
1443 p1 := id.NewPlannedPermanode("1")
1444 p2 := id.NewPlannedPermanode("2")
1445 p3 := id.NewPlannedPermanode("3")
1446
1447 id.AddAttribute(pdir, "camliMember", p1.String())
1448 id.AddAttribute(pdir, "camliPath:foo", p2.String())
1449 id.AddAttribute(pdir, "other", p3.String())
1450
1451 // Make p1, p2, and p3 actually exist. (permanodes without attributes are dead)
1452 id.AddAttribute(p1, "x", "x")
1453 id.AddAttribute(p2, "x", "x")
1454 id.AddAttribute(p3, "x", "x")
1455
1456 sq := &SearchQuery{
1457 Constraint: &Constraint{
1458 Permanode: &PermanodeConstraint{
1459 Relation: &RelationConstraint{
1460 Relation: "parent",
1461 Any: &Constraint{
1462 BlobRefPrefix: pdir.String(),
1463 },
1464 },
1465 },
1466 },
1467 }
1468 qt.wantRes(sq, p1, p2)
1469 })
1470}
1471
1472func TestQueryParent(t *testing.T) {
1473 testQueryTypes(t, memIndexTypes, func(qt *queryTest) {

Callers

nothing calls this directly

Calls 5

testQueryTypesFunction · 0.85
NewPlannedPermanodeMethod · 0.80
AddAttributeMethod · 0.80
wantResMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected