| 30 | } |
| 31 | |
| 32 | func TestColumnify(t *testing.T) { |
| 33 | scenarios := []struct { |
| 34 | val string |
| 35 | expected string |
| 36 | }{ |
| 37 | {"", ""}, |
| 38 | {" ", ""}, |
| 39 | {"123", "123"}, |
| 40 | {"Test.", "Test."}, |
| 41 | {" test ", "test"}, |
| 42 | {"test1.test2", "test1.test2"}, |
| 43 | {"@test!abc", "@testabc"}, |
| 44 | {"#test?abc", "#testabc"}, |
| 45 | {"123test(123)#", "123test123#"}, |
| 46 | {"test1--test2", "test1--test2"}, |
| 47 | } |
| 48 | |
| 49 | for i, s := range scenarios { |
| 50 | t.Run(fmt.Sprintf("%d_%#v", i, s.val), func(t *testing.T) { |
| 51 | result := inflector.Columnify(s.val) |
| 52 | if result != s.expected { |
| 53 | t.Fatalf("Expected %q, got %q", s.expected, result) |
| 54 | } |
| 55 | }) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | func TestSentenize(t *testing.T) { |
| 60 | scenarios := []struct { |