diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2017-06-14 00:42:15 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2017-06-14 00:42:15 -0400 |
| commit | d57d2c7d60fd5cfa43e83445675a87da9ce19d29 (patch) | |
| tree | 3b1e7220bb71d58a8ec14cca564a9f304d5d42c4 /strings/strings_test.go | |
| parent | 19c7f34bcacded8002fe561a728cfc05a2d6da06 (diff) | |
Enhancing indent function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'strings/strings_test.go')
| -rw-r--r-- | strings/strings_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/strings/strings_test.go b/strings/strings_test.go new file mode 100644 index 00000000..03338cd8 --- /dev/null +++ b/strings/strings_test.go @@ -0,0 +1,17 @@ +package strings + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestIndent(t *testing.T) { + actual := "hello\nworld\n!" + expected := " hello\n world\n !" + assert.Equal(t, expected, Indent(1, " ", actual)) + assert.Equal(t, "\n", Indent(1, " ", "\n")) + assert.Equal(t, " foo\n", Indent(1, " ", "foo\n")) + assert.Equal(t, " foo", Indent(1, " ", "foo")) + assert.Equal(t, " foo", Indent(3, " ", "foo")) +} |
