Encoder: try to use pointer type TextMarshaler (#679)
If a type does not implement the encoding.TextMarshaler interface but its pointer type does, use it if possible. Fixes #678
This commit is contained in:
@@ -664,6 +664,36 @@ func TestUnmarshal(t *testing.T) {
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "long string array into []string",
|
||||
input: `A = ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"]`,
|
||||
gen: func() test {
|
||||
type doc struct {
|
||||
A []string
|
||||
}
|
||||
|
||||
return test{
|
||||
target: &doc{},
|
||||
expected: &doc{A: []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17"}},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "long string array into []interface{}",
|
||||
input: `A = ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14",
|
||||
"15","16","17"]`,
|
||||
gen: func() test {
|
||||
type doc struct {
|
||||
A []interface{}
|
||||
}
|
||||
|
||||
return test{
|
||||
target: &doc{},
|
||||
expected: &doc{A: []interface{}{"0", "1", "2", "3", "4", "5", "6",
|
||||
"7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17"}},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "standard table",
|
||||
input: `[A]
|
||||
|
||||
Reference in New Issue
Block a user