summaryrefslogtreecommitdiffstats
path: root/tpl/transform/unmarshal_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-12-23 16:43:04 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-12-23 16:43:04 +0100
commit094709e105d48547bf5297adc0ad0c777678b0a6 (patch)
tree8adbd188786096939ca10d70031bb66d7f5f0bfb /tpl/transform/unmarshal_test.go
parenta5744697971d296eb973e04e4259fe9e516b908f (diff)
tpl/transform: Simplify transform.Unmarshal func
See #5428
Diffstat (limited to 'tpl/transform/unmarshal_test.go')
-rw-r--r--tpl/transform/unmarshal_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/tpl/transform/unmarshal_test.go b/tpl/transform/unmarshal_test.go
index 00424c693..b1ce30b1f 100644
--- a/tpl/transform/unmarshal_test.go
+++ b/tpl/transform/unmarshal_test.go
@@ -102,23 +102,23 @@ func TestUnmarshal(t *testing.T) {
{`slogan = "Hugo Rocks!"`, nil, func(m map[string]interface{}) {
assertSlogan(m)
}},
- {testContentResource{content: `slogan: "Hugo Rocks!"`, mime: media.YAMLType}, nil, func(m map[string]interface{}) {
+ {testContentResource{key: "r1", content: `slogan: "Hugo Rocks!"`, mime: media.YAMLType}, nil, func(m map[string]interface{}) {
assertSlogan(m)
}},
- {testContentResource{content: `{ "slogan": "Hugo Rocks!" }`, mime: media.JSONType}, nil, func(m map[string]interface{}) {
+ {testContentResource{key: "r1", content: `{ "slogan": "Hugo Rocks!" }`, mime: media.JSONType}, nil, func(m map[string]interface{}) {
assertSlogan(m)
}},
- {testContentResource{content: `slogan = "Hugo Rocks!"`, mime: media.TOMLType}, nil, func(m map[string]interface{}) {
+ {testContentResource{key: "r1", content: `slogan = "Hugo Rocks!"`, mime: media.TOMLType}, nil, func(m map[string]interface{}) {
assertSlogan(m)
}},
- {testContentResource{content: `1997,Ford,E350,"ac, abs, moon",3000.00
+ {testContentResource{key: "r1", content: `1997,Ford,E350,"ac, abs, moon",3000.00
1999,Chevy,"Venture ""Extended Edition""","",4900.00`, mime: media.CSVType}, nil, func(r [][]string) {
assert.Equal(2, len(r))
first := r[0]
assert.Equal(5, len(first))
assert.Equal("Ford", first[1])
}},
- {testContentResource{content: `a;b;c`, mime: media.CSVType}, map[string]interface{}{"comma": ";"}, func(r [][]string) {
+ {testContentResource{key: "r1", content: `a;b;c`, mime: media.CSVType}, map[string]interface{}{"comma": ";"}, func(r [][]string) {
assert.Equal(r, [][]string{[]string{"a", "b", "c"}})
}},
@@ -130,7 +130,7 @@ func TestUnmarshal(t *testing.T) {
assert.Equal(r, [][]string{[]string{"a", "b", "c"}})
}},
- {testContentResource{content: `
+ {testContentResource{key: "r1", content: `
% This is a comment
a;b;c`, mime: media.CSVType}, map[string]interface{}{"CommA": ";", "Comment": "%"}, func(r [][]string) {
assert.Equal(r, [][]string{[]string{"a", "b", "c"}})
@@ -138,8 +138,8 @@ a;b;c`, mime: media.CSVType}, map[string]interface{}{"CommA": ";", "Comment": "%
}},
// errors
{"thisisnotavaliddataformat", nil, false},
- {testContentResource{content: `invalid&toml"`, mime: media.TOMLType}, nil, false},
- {testContentResource{content: `unsupported: MIME"`, mime: media.CalendarType}, nil, false},
+ {testContentResource{key: "r1", content: `invalid&toml"`, mime: media.TOMLType}, nil, false},
+ {testContentResource{key: "r1", content: `unsupported: MIME"`, mime: media.CalendarType}, nil, false},
{"thisisnotavaliddataformat", nil, false},
{`{ notjson }`, nil, false},
{tstNoStringer{}, nil, false},