diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-19 16:34:46 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-24 20:14:41 +1100 |
commit | bf4f06ab4e6ceefe388e0efefcc553526f3d96c2 (patch) | |
tree | b4cfdb71e31fa7d960722f192a56e5fb1a483e5e /pkg/utils | |
parent | eda8f4a5d4302691d99efd066f9851809c984bc0 (diff) |
more generics
Diffstat (limited to 'pkg/utils')
-rw-r--r-- | pkg/utils/lines.go | 9 | ||||
-rw-r--r-- | pkg/utils/lines_test.go | 23 |
2 files changed, 0 insertions, 32 deletions
diff --git a/pkg/utils/lines.go b/pkg/utils/lines.go index 9aea84bff..47d33e939 100644 --- a/pkg/utils/lines.go +++ b/pkg/utils/lines.go @@ -17,15 +17,6 @@ func SplitLines(multilineString string) []string { return lines } -// TrimTrailingNewline - Trims the trailing newline -// TODO: replace with `chomp` after refactor -func TrimTrailingNewline(str string) string { - if strings.HasSuffix(str, "\n") { - return str[:len(str)-1] - } - return str -} - // NormalizeLinefeeds - Removes all Windows and Mac style line feeds func NormalizeLinefeeds(str string) string { str = strings.Replace(str, "\r\n", "\n", -1) diff --git a/pkg/utils/lines_test.go b/pkg/utils/lines_test.go index faafb863a..361f0a510 100644 --- a/pkg/utils/lines_test.go +++ b/pkg/utils/lines_test.go @@ -36,29 +36,6 @@ func TestSplitLines(t *testing.T) { } } -// TestTrimTrailingNewline is a function. -func TestTrimTrailingNewline(t *testing.T) { - type scenario struct { - str string - expected string - } - - scenarios := []scenario{ - { - "hello world !\n", - "hello world !", - }, - { - "hello world !", - "hello world !", - }, - } - - for _, s := range scenarios { - assert.EqualValues(t, s.expected, TrimTrailingNewline(s.str)) - } -} - // TestNormalizeLinefeeds is a function. func TestNormalizeLinefeeds(t *testing.T) { type scenario struct { |