MCPcopy
hub / github.com/perkeep/perkeep / TestQueryLogicalAnd

Function TestQueryLogicalAnd

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

Source from the content-addressed store, hash-verified

313}
314
315func TestQueryLogicalAnd(t *testing.T) {
316 testQuery(t, func(qt *queryTest) {
317 id := qt.id
318
319 // foo is sha224-0808f64e60d58979fcb676c96ec938270dea42445aeefcd3a4e6f8db
320 _, foo := id.UploadFile("file.txt", "foo", time.Unix(1382073153, 0))
321 // bar.. is sha224-81d6d49dac1a465f90b0225461a90cc11a5a8675b4457762d52760aa
322 id.UploadFile("file.txt", "bar..", time.Unix(1382073153, 0))
323
324 sq := &SearchQuery{
325 Constraint: &Constraint{
326 Logical: &LogicalConstraint{
327 Op: "and",
328 A: &Constraint{
329 BlobRefPrefix: "sha224-08",
330 },
331 B: &Constraint{
332 BlobSize: &IntConstraint{
333 Max: int64(len("foo")), // excludes "bar.."
334 },
335 },
336 },
337 },
338 }
339 qt.wantRes(sq, foo)
340 })
341}
342
343func TestQueryLogicalXor(t *testing.T) {
344 testQuery(t, func(qt *queryTest) {

Callers

nothing calls this directly

Calls 3

testQueryFunction · 0.85
wantResMethod · 0.80
UploadFileMethod · 0.45

Tested by

no test coverage detected