From 90b0c0dcf72496ccfa51ef78b77227ed872ab88b Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Tue, 21 Nov 2017 21:39:21 +0900 Subject: [PATCH] Test utils.go --- utils_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/utils_test.go b/utils_test.go index 06ab7d0..5f7a6af 100644 --- a/utils_test.go +++ b/utils_test.go @@ -1 +1,22 @@ package main + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestStringSetToSlice(t *testing.T) { + assert.Equal(t, []string{"foo", "bar"}, stringSetToSlice(map[string]bool{"foo": true, "bar": false})) +} + +func TestIndent(t *testing.T) { + for _, c := range []struct { + source, target string + }{ + {"foo", "\tfoo"}, + {"foo\nbar", "\tfoo\n\tbar"}, + } { + assert.Equal(t, c.target, indent(c.source)) + } +}