MCPcopy
hub / github.com/perkeep/perkeep / TestQueryFileConstraint_WholeRef

Function TestQueryFileConstraint_WholeRef

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

Source from the content-addressed store, hash-verified

1024}
1025
1026func TestQueryFileConstraint_WholeRef(t *testing.T) {
1027 testQueryTypes(t, memIndexTypes, func(qt *queryTest) {
1028 id := qt.id
1029 fileRef, _ := id.UploadFile("some-stuff.txt", "hello", time.Unix(123, 0))
1030 qt.t.Logf("fileRef = %q", fileRef)
1031 p1 := id.NewPlannedPermanode("1")
1032 id.SetAttribute(p1, "camliContent", fileRef.String())
1033
1034 fileRef2, _ := id.UploadFile("other-file", "hellooooo", time.Unix(456, 0))
1035 qt.t.Logf("fileRef2 = %q", fileRef2)
1036 p2 := id.NewPlannedPermanode("2")
1037 id.SetAttribute(p2, "camliContent", fileRef2.String())
1038
1039 sq := &SearchQuery{
1040 Constraint: &Constraint{
1041 Permanode: &PermanodeConstraint{
1042 Attr: "camliContent",
1043 ValueInSet: &Constraint{
1044 File: &FileConstraint{
1045 WholeRef: blob.RefFromString("hello"),
1046 },
1047 },
1048 },
1049 },
1050 }
1051 qt.wantRes(sq, p1)
1052 })
1053}
1054
1055func TestQueryPermanodeModtime(t *testing.T) {
1056 testQuery(t, func(qt *queryTest) {

Callers

nothing calls this directly

Calls 8

RefFromStringFunction · 0.92
testQueryTypesFunction · 0.85
LogfMethod · 0.80
NewPlannedPermanodeMethod · 0.80
SetAttributeMethod · 0.80
wantResMethod · 0.80
UploadFileMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected