summaryrefslogtreecommitdiffstats
path: root/tpl/collections/collections_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/collections/collections_test.go')
-rw-r--r--tpl/collections/collections_test.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/tpl/collections/collections_test.go b/tpl/collections/collections_test.go
index 24d3b051c..21c8bfb56 100644
--- a/tpl/collections/collections_test.go
+++ b/tpl/collections/collections_test.go
@@ -348,6 +348,9 @@ func TestIn(t *testing.T) {
// template.HTML
{template.HTML("this substring should be found"), "substring", true},
{template.HTML("this substring should not be found"), "subseastring", false},
+ // Uncomparable, use hashstructure
+ {[]string{"a", "b"}, []string{"a", "b"}, false},
+ {[][]string{{"a", "b"}}, []string{"a", "b"}, true},
} {
errMsg := qt.Commentf("[%d] %v", i, test)
@@ -356,10 +359,6 @@ func TestIn(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(result, qt.Equals, test.expect, errMsg)
}
-
- // Slices are not comparable
- _, err := ns.In([]string{"a", "b"}, []string{"a", "b"})
- c.Assert(err, qt.Not(qt.IsNil))
}
type testPage struct {
@@ -835,9 +834,14 @@ func TestUniq(t *testing.T) {
// Structs
{pagesVals{p3v, p2v, p3v, p2v}, pagesVals{p3v, p2v}, false},
+ // not Comparable(), use hashstruscture
+ {[]map[string]int{
+ {"K1": 1}, {"K2": 2}, {"K1": 1}, {"K2": 1},
+ }, []map[string]int{
+ {"K1": 1}, {"K2": 2}, {"K2": 1},
+ }, false},
+
// should fail
- // uncomparable types
- {[]map[string]int{{"K1": 1}}, []map[string]int{{"K2": 2}, {"K2": 2}}, true},
{1, 1, true},
{"foo", "fo", true},
} {