mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
@@ -87,7 +87,8 @@ func (ns *Namespace) checkCondition(v, mv reflect.Value, op string) (bool, error
|
|||||||
var ima []int64
|
var ima []int64
|
||||||
var fma []float64
|
var fma []float64
|
||||||
var sma []string
|
var sma []string
|
||||||
if mv.Type() == v.Type() {
|
|
||||||
|
if mv.Kind() == v.Kind() {
|
||||||
switch v.Kind() {
|
switch v.Kind() {
|
||||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||||
iv := v.Int()
|
iv := v.Int()
|
||||||
|
@@ -15,6 +15,7 @@ package collections
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html/template"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -146,6 +147,17 @@ func TestWhere(t *testing.T) {
|
|||||||
key: "b", match: 2.0, op: ">=",
|
key: "b", match: 2.0, op: ">=",
|
||||||
expect: []map[string]float64{{"a": 1, "b": 2}, {"a": 3, "b": 3}},
|
expect: []map[string]float64{{"a": 1, "b": 2}, {"a": 3, "b": 3}},
|
||||||
},
|
},
|
||||||
|
// Issue #8353
|
||||||
|
// String type mismatch.
|
||||||
|
{
|
||||||
|
seq: []map[string]interface{}{
|
||||||
|
{"a": "1", "b": "2"}, {"a": "3", "b": template.HTML("4")}, {"a": "5", "x": "4"},
|
||||||
|
},
|
||||||
|
key: "b", match: "4",
|
||||||
|
expect: []map[string]interface{}{
|
||||||
|
{"a": "3", "b": template.HTML("4")},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
seq: []TstX{
|
seq: []TstX{
|
||||||
{A: "a", B: "b"}, {A: "c", B: "d"}, {A: "e", B: "f"},
|
{A: "a", B: "b"}, {A: "c", B: "d"}, {A: "e", B: "f"},
|
||||||
|
Reference in New Issue
Block a user