mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
tpl/collections: Convert numeric values to float64 and compare them
Fixes #5685
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
4c560020bc
commit
fb007e9ae5
@@ -84,6 +84,27 @@ func TestWhere(t *testing.T) {
|
||||
key: "b", match: 4.0, op: "<",
|
||||
expect: []map[string]float64{{"a": 1, "b": 2}},
|
||||
},
|
||||
{
|
||||
seq: []map[string]float64{
|
||||
{"a": 1, "b": 2}, {"a": 3, "b": 4}, {"a": 5, "x": 4},
|
||||
},
|
||||
key: "b", match: 4, op: "<",
|
||||
expect: []map[string]float64{{"a": 1, "b": 2}},
|
||||
},
|
||||
{
|
||||
seq: []map[string]int{
|
||||
{"a": 1, "b": 2}, {"a": 3, "b": 4}, {"a": 5, "x": 4},
|
||||
},
|
||||
key: "b", match: 4.0, op: "<",
|
||||
expect: []map[string]int{{"a": 1, "b": 2}},
|
||||
},
|
||||
{
|
||||
seq: []map[string]int{
|
||||
{"a": 1, "b": 2}, {"a": 3, "b": 4}, {"a": 5, "x": 4},
|
||||
},
|
||||
key: "b", match: 4.2, op: "<",
|
||||
expect: []map[string]int{{"a": 1, "b": 2}, {"a": 3, "b": 4}},
|
||||
},
|
||||
{
|
||||
seq: []map[string]float64{
|
||||
{"a": 1, "b": 2}, {"a": 3, "b": 4}, {"a": 5, "x": 4},
|
||||
|
Reference in New Issue
Block a user