More tests

This commit is contained in:
Mike Farah 2017-04-14 12:39:55 +10:00
parent 124c57f9d9
commit 373e0a5eb7
2 changed files with 17 additions and 1 deletions

2
.gitignore vendored
View File

@ -20,7 +20,7 @@ _cgo_gotypes.go
_cgo_export.*
_testmain.go
coverage.out
*.exe
*.test
*.prof

View File

@ -215,3 +215,19 @@ b:
b := entryInSlice(updated, "b").Value
assertResult(t, "4", fmt.Sprintf("%v", b))
}
func TestWriteMap_no_paths(t *testing.T) {
var data = parseData(`
b: 5
`)
result := writeMap(data, []string{}, 4)
assertResult(t, fmt.Sprintf("%v", data), fmt.Sprintf("%v", result))
}
func TestWriteArray_no_paths(t *testing.T) {
var data = make([]interface{}, 1)
data[0] = "mike"
result := writeArray(data, []string{}, 4)
assertResult(t, fmt.Sprintf("%v", data), fmt.Sprintf("%v", result))
}