File tree 2 files changed +41
-0
lines changed
2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,16 @@ type t5b struct {
93
93
K5 tObjStr
94
94
}
95
95
96
+ type tFieldSort1 struct {
97
+ Aaaaa string
98
+ Bbbb string
99
+ Ddd string
100
+ Ccc string
101
+ Eee string
102
+ Ff string
103
+ G string
104
+ }
105
+
96
106
var objFixtures = []struct {
97
107
title string
98
108
@@ -401,6 +411,24 @@ var objFixtures = []struct {
401
411
}},
402
412
},
403
413
},
414
+ {title : "struct with fields in different than expected order (rfc7049 expected)" ,
415
+ sequence : fixtures .SequenceMap ["7 struct rfc7049 order" ],
416
+ atlas : atlas .MustBuild (atlas .BuildEntry (tFieldSort1 {}).StructMap ().AutogenerateWithSortingScheme (atlas .KeySortMode_RFC7049 ).Complete ()),
417
+ marshalResults : []marshalResults {
418
+ {title : "from struct" ,
419
+ valueFn : func () interface {} {
420
+ return tFieldSort1 {
421
+ G : "1" ,
422
+ Ff : "2" ,
423
+ Ccc : "3" ,
424
+ Ddd : "4" ,
425
+ Eee : "5" ,
426
+ Bbbb : "6" ,
427
+ Aaaaa : "7" ,
428
+ }
429
+ }},
430
+ },
431
+ },
404
432
{title : "empty primitive arrays" ,
405
433
sequence : fixtures .SequenceMap ["empty array" ],
406
434
marshalResults : []marshalResults {
Original file line number Diff line number Diff line change @@ -117,6 +117,19 @@ var Sequences = []Sequence{
117
117
{Type : TMapClose },
118
118
},
119
119
},
120
+ {"7 struct rfc7049 order" ,
121
+ []Token {
122
+ {Type : TMapOpen , Length : 7 },
123
+ TokStr ("g" ), TokStr ("1" ),
124
+ TokStr ("ff" ), TokStr ("2" ),
125
+ TokStr ("ccc" ), TokStr ("3" ),
126
+ TokStr ("ddd" ), TokStr ("4" ),
127
+ TokStr ("eee" ), TokStr ("5" ),
128
+ TokStr ("bbbb" ), TokStr ("6" ),
129
+ TokStr ("aaaaa" ), TokStr ("7" ),
130
+ {Type : TMapClose },
131
+ },
132
+ },
120
133
121
134
// Arrays.
122
135
{"empty array" ,
You can’t perform that action at this time.
0 commit comments