summaryrefslogtreecommitdiffstats
path: root/tpl/collections/collections_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-04-18 17:06:54 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-04-18 23:42:01 +0200
commit06f56fc983d460506d39b3a6f638b1632af07073 (patch)
tree88f8a53b384e303f008842c859f0170b3450cdcf /tpl/collections/collections_test.go
parentd7a67dcb51829b12d492d3f2ee4f6e2a3834da63 (diff)
tpl/collections: Make Pages etc. work with the in func
Fixes #5875
Diffstat (limited to 'tpl/collections/collections_test.go')
-rw-r--r--tpl/collections/collections_test.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/tpl/collections/collections_test.go b/tpl/collections/collections_test.go
index 741dd074d..c87490b2c 100644
--- a/tpl/collections/collections_test.go
+++ b/tpl/collections/collections_test.go
@@ -276,6 +276,7 @@ func TestFirst(t *testing.T) {
func TestIn(t *testing.T) {
t.Parallel()
+ assert := require.New(t)
ns := New(&deps.Deps{})
@@ -302,12 +303,18 @@ func TestIn(t *testing.T) {
{"this substring should be found", "substring", true},
{"this substring should not be found", "subseastring", false},
{nil, "foo", false},
+ // Pointers
+ {pagesPtr{p1, p2, p3, p2}, p2, true},
+ {pagesPtr{p1, p2, p3, p2}, p4, false},
+ // Structs
+ {pagesVals{p3v, p2v, p3v, p2v}, p2v, true},
+ {pagesVals{p3v, p2v, p3v, p2v}, p4v, false},
} {
errMsg := fmt.Sprintf("[%d] %v", i, test)
result := ns.In(test.l1, test.l2)
- assert.Equal(t, test.expect, result, errMsg)
+ assert.Equal(test.expect, result, errMsg)
}
}