File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
package gen
2
2
3
3
import (
4
+ "fmt"
4
5
"testing"
5
6
6
7
"github.com/goccy/go-yaml"
@@ -100,12 +101,24 @@ c_key = "value3"
100
101
` ,
101
102
expectErr : nil ,
102
103
},
104
+
105
+ {
106
+ name : "Table Test" ,
107
+ data : & yaml.MapSlice {
108
+ {Key : "a_key" , Value : map [string ]string {
109
+ "a_a_key" : "value2" ,
110
+ }},
111
+ {Key : "b_key" , Value : "value1" },
112
+ },
113
+ expectedTOML : "" ,
114
+ expectErr : fmt .Errorf ("unsupported to define 'b_key' after a table, ref: https://toml.io/en/v1.0.0#table" ),
115
+ },
103
116
}
104
117
105
118
for _ , tt := range tests {
106
119
t .Run (tt .name , func (t * testing.T ) {
107
120
tomlData , err := toml .Marshal (tt .data )
108
- if err != tt .expectErr {
121
+ if err . Error () != tt .expectErr . Error () {
109
122
t .Fatalf ("expected error: %v, got: %v" , tt .expectErr , err )
110
123
}
111
124
You can’t perform that action at this time.
0 commit comments