From 617e2e9df2aed6c17a4eee7b3b963a2388a1ec11 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Fri, 12 May 2017 09:11:52 -0400 Subject: Adding new indent function Signed-off-by: Dave Henderson --- typeconv_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'typeconv_test.go') diff --git a/typeconv_test.go b/typeconv_test.go index ae2424ce..85620b7c 100644 --- a/typeconv_test.go +++ b/typeconv_test.go @@ -169,3 +169,16 @@ func TestHas(t *testing.T) { assert.False(t, ty.Has(in, "bar")) assert.True(t, ty.Has(in["baz"], "qux")) } + +func TestIndent(t *testing.T) { + ty := new(TypeConv) + actual := "hello\nworld\n!" + expected := " hello\n world\n !" + assert.Equal(t, expected, ty.indent(" ", actual)) + + assert.Equal(t, "\n", ty.indent(" ", "\n")) + + assert.Equal(t, " foo\n", ty.indent(" ", "foo\n")) + + assert.Equal(t, " foo", ty.indent(" ", "foo")) +} -- cgit v1.2.3