Merge pull request #6149 from bep/sort-caseinsensitive

Implement lexicographically string sorting
This commit is contained in:
Bjørn Erik Pedersen 2019-08-01 10:19:19 +02:00 committed by GitHub
parent a4f96a9d8c
commit 53077b0da5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 246 additions and 34 deletions

View file

@ -83,7 +83,7 @@ func TestDefaultFunc(t *testing.T) {
then := time.Now()
now := time.Now()
ns := New()
ns := New(false)
for i, test := range []struct {
dflt interface{}
@ -139,7 +139,7 @@ func TestDefaultFunc(t *testing.T) {
func TestCompare(t *testing.T) {
t.Parallel()
n := New()
n := New(false)
for _, test := range []struct {
tstCompareType
@ -233,6 +233,14 @@ func doTestCompare(t *testing.T, tp tstCompareType, funcUnderTest func(a, b inte
}
}
func TestCase(t *testing.T) {
assert := require.New(t)
n := New(true)
assert.True(n.Lt("az", "Za"))
assert.True(n.Gt("ab", "Ab"))
}
func TestTimeUnix(t *testing.T) {
t.Parallel()
var sec int64 = 1234567890
@ -258,7 +266,7 @@ func TestTimeUnix(t *testing.T) {
func TestConditional(t *testing.T) {
assert := require.New(t)
n := New()
n := New(false)
a, b := "a", "b"
assert.Equal(a, n.Conditional(true, a, b))