MCPcopy Index your code
hub / github.com/upper/db / TestCond

Function TestCond

cond_test.go:9–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestCond(t *testing.T) {
10 t.Run("Base", func(t *testing.T) {
11 var c Cond
12
13 c = Cond{}
14 assert.True(t, c.Empty())
15
16 c = Cond{"id": 1}
17 assert.False(t, c.Empty())
18 })
19
20 t.Run("And", func(t *testing.T) {
21 var a *AndExpr
22
23 a = And()
24 assert.True(t, a.Empty())
25
26 _ = a.And(Cond{"id": 1})
27 assert.True(t, a.Empty(), "conditions are immutable")
28
29 a = a.And(Cond{"name": "Ana"})
30 assert.False(t, a.Empty())
31
32 a = a.And().And()
33 assert.False(t, a.Empty())
34 })
35
36 t.Run("Or", func(t *testing.T) {
37 var a *OrExpr
38
39 a = Or()
40 assert.True(t, a.Empty())
41
42 _ = a.Or(Cond{"id": 1})
43 assert.True(t, a.Empty(), "conditions are immutable")
44
45 a = a.Or(Cond{"name": "Ana"})
46 assert.False(t, a.Empty())
47
48 a = a.Or().Or()
49 assert.False(t, a.Empty())
50 })
51}

Callers

nothing calls this directly

Calls 6

EmptyMethod · 0.95
EmptyMethod · 0.95
OrMethod · 0.95
AndFunction · 0.70
OrFunction · 0.70
AndMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…