diff options
Diffstat (limited to 'tpl/compare')
-rw-r--r-- | tpl/compare/compare.go | 2 | ||||
-rw-r--r-- | tpl/compare/compare_test.go | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tpl/compare/compare.go b/tpl/compare/compare.go index e005aff06..50dafae3c 100644 --- a/tpl/compare/compare.go +++ b/tpl/compare/compare.go @@ -111,6 +111,8 @@ func (n *Namespace) Eq(first interface{}, others ...interface{}) bool { return vv.Float() case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return vv.Uint() + case reflect.String: + return vv.String() default: return v } diff --git a/tpl/compare/compare_test.go b/tpl/compare/compare_test.go index 3eb793d30..c21ca11bc 100644 --- a/tpl/compare/compare_test.go +++ b/tpl/compare/compare_test.go @@ -63,6 +63,8 @@ func (t tstEqerType1) String() string { return string(t) } +type stringType string + type tstCompareType int const ( @@ -391,6 +393,15 @@ func TestLessThanExtend(t *testing.T) { func TestCase(t *testing.T) { c := qt.New(t) + n := New(false) + + c.Assert(n.Eq("az", "az"), qt.Equals, true) + c.Assert(n.Eq("az", stringType("az")), qt.Equals, true) + +} + +func TestStringType(t *testing.T) { + c := qt.New(t) n := New(true) c.Assert(n.Lt("az", "Za"), qt.Equals, true) |