From c56dc624778fc3f9695a712c02c8b306da0c88b2 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Wed, 18 Jul 2018 21:35:33 -0400 Subject: Adding new strings.Sort function Signed-off-by: Dave Henderson --- strings/strings_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'strings/strings_test.go') diff --git a/strings/strings_test.go b/strings/strings_test.go index ad32e3f6..f2afb2f5 100644 --- a/strings/strings_test.go +++ b/strings/strings_test.go @@ -25,3 +25,17 @@ func TestTrunc(t *testing.T) { assert.Equal(t, "hello, world", Trunc(42, "hello, world")) assert.Equal(t, "hello, world", Trunc(-1, "hello, world")) } + +func TestSort(t *testing.T) { + in := []string{} + expected := []string{} + assert.EqualValues(t, expected, Sort(in)) + + in = []string{"c", "a", "b"} + expected = []string{"a", "b", "c"} + assert.EqualValues(t, expected, Sort(in)) + + in = []string{"42", "45", "18"} + expected = []string{"18", "42", "45"} + assert.EqualValues(t, expected, Sort(in)) +} -- cgit v1.2.3