File: sort_test.go

package info (click to toggle)
golang-github-urfave-cli 1.22.5-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 728 kB
  • sloc: sh: 17; makefile: 4
file content (30 lines) | stat: -rw-r--r-- 587 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package cli

import "testing"

var lexicographicLessTests = []struct {
	i        string
	j        string
	expected bool
}{
	{"", "a", true},
	{"a", "", false},
	{"a", "a", false},
	{"a", "A", false},
	{"A", "a", true},
	{"aa", "a", false},
	{"a", "aa", true},
	{"a", "b", true},
	{"a", "B", true},
	{"A", "b", true},
	{"A", "B", true},
}

func TestLexicographicLess(t *testing.T) {
	for _, test := range lexicographicLessTests {
		actual := lexicographicLess(test.i, test.j)
		if test.expected != actual {
			t.Errorf(`expected string "%s" to come before "%s"`, test.i, test.j)
		}
	}
}