| 1 | package imported_testsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/ //revive:disable:var-naming |
| 2 | |
| 3 | // Those tests were imported directly from go-toml v1 |
| 4 | // https://raw.githubusercontent.com/pelletier/go-toml/a2e52561804c6cd9392ebf0048ca64fe4af67a43/marshal_test.go |
| 5 | // They have been cleaned up to only include Unmarshal tests, and only depend |
| 6 | // on the public API. Tests related to strict mode have been commented out and |
| 7 | // marked as skipped until we figure out if that's something we want in v2. |
| 8 | |
| 9 | import ( |
| 10 | "bytesscip-go gomod github.com/golang/go/src go1.21.0 bytes/" |
| 11 | "errorsscip-go gomod github.com/golang/go/src go1.21.0 errors/" |
| 12 | "fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/" |
| 13 | "reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/" |
| 14 | "strconvscip-go gomod github.com/golang/go/src go1.21.0 strconv/" |
| 15 | "testingscip-go gomod github.com/golang/go/src go1.21.0 testing/" |
| 16 | "timescip-go gomod github.com/golang/go/src go1.21.0 time/" |
| 17 | |
| 18 | "github.com/pelletier/go-toml/v2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/" |
| 19 | "github.com/pelletier/go-toml/v2/internal/assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/" |
| 20 | ) |
| 21 | |
| 22 | type basicMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct# struct { |
| 23 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#String. string `toml:"Zstring"` |
| 24 | StringListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#StringList. []string `toml:"Ystrlist"` |
| 25 | BasicMarshalTestSubAnonymousStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#BasicMarshalTestSubAnonymousStruct. |
| 26 | Subscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#Sub. basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# `toml:"Xsubdoc"` |
| 27 | SubListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#SubList. []basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# `toml:"Wsublist"` |
| 28 | } |
| 29 | |
| 30 | type basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# struct { |
| 31 | String2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#String2. string |
| 32 | } |
| 33 | |
| 34 | type BasicMarshalTestSubAnonymousStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/BasicMarshalTestSubAnonymousStruct# struct { |
| 35 | String3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/BasicMarshalTestSubAnonymousStruct#String3. string |
| 36 | } |
| 37 | |
| 38 | var basicTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicTestData. = basicMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#{ |
| 39 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#String.: "Hello", |
| 40 | StringListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#StringList.: []string{"Howdy", "Hey There"}, |
| 41 | BasicMarshalTestSubAnonymousStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#BasicMarshalTestSubAnonymousStruct.: BasicMarshalTestSubAnonymousStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/BasicMarshalTestSubAnonymousStruct#{"One"}, |
| 42 | Subscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#Sub.: basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{"Two"}, |
| 43 | SubListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#SubList.: []basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{{"Three"}, {"Four"}}, |
| 44 | } |
| 45 | |
| 46 | var basicTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicTestToml. = []byte(`String3 = "One" |
| 47 | Ystrlist = ["Howdy", "Hey There"] |
| 48 | Zstring = "Hello" |
| 49 | |
| 50 | [[Wsublist]] |
| 51 | String2 = "Three" |
| 52 | |
| 53 | [[Wsublist]] |
| 54 | String2 = "Four" |
| 55 | |
| 56 | [Xsubdoc] |
| 57 | String2 = "Two" |
| 58 | `) |
| 59 | |
| 60 | var marshalTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/marshalTestToml. = []byte(`title = "TOML Marshal Testing" |
| 61 | |
| 62 | [basic] |
| 63 | bool = true |
| 64 | date = 1979-05-27T07:32:00Z |
| 65 | float = 123.4 |
| 66 | float64 = 123.456782132399 |
| 67 | int = 5000 |
| 68 | string = "Bite me" |
| 69 | uint = 5001 |
| 70 | |
| 71 | [basic_lists] |
| 72 | bools = [true, false, true] |
| 73 | dates = [1979-05-27T07:32:00Z, 1980-05-27T07:32:00Z] |
| 74 | floats = [12.3, 45.6, 78.9] |
| 75 | ints = [8001, 8001, 8002] |
| 76 | strings = ["One", "Two", "Three"] |
| 77 | uints = [5002, 5003] |
| 78 | |
| 79 | [basic_map] |
| 80 | one = "one" |
| 81 | two = "two" |
| 82 | |
| 83 | [subdoc] |
| 84 | |
| 85 | [subdoc.first] |
| 86 | name = "First" |
| 87 | |
| 88 | [subdoc.second] |
| 89 | name = "Second" |
| 90 | |
| 91 | [[subdoclist]] |
| 92 | name = "List.First" |
| 93 | |
| 94 | [[subdoclist]] |
| 95 | name = "List.Second" |
| 96 | |
| 97 | [[subdocptrs]] |
| 98 | name = "Second" |
| 99 | `) |
| 100 | |
| 101 | type Confscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf# struct { |
| 102 | Namescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf#Name. string |
| 103 | Agescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf#Age. int |
| 104 | Interscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf#Inter. interface{} |
| 105 | } |
| 106 | |
| 107 | type NestedStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/NestedStruct# struct { |
| 108 | FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/NestedStruct#FirstName. string |
| 109 | LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/NestedStruct#LastName. string |
| 110 | Agescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/NestedStruct#Age. int |
| 111 | } |
| 112 | |
| 113 | var docscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/doc. = []byte(`Name = "rui" |
| 114 | Age = 18 |
| 115 | |
| 116 | [Inter] |
| 117 | FirstName = "wang" |
| 118 | LastName = "jl" |
| 119 | Age = 100`) |
| 120 | |
| 121 | func TestInterfacescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestInterface().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 122 | var config Confscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf# |
| 123 | config.Interscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf#Inter. = &NestedStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/NestedStruct#{} |
| 124 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(docscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/doc., &config) |
| 125 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 126 | expected := Confscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf#{ |
| 127 | Namescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf#Name.: "rui", |
| 128 | Agescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf#Age.: 18, |
| 129 | Interscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Conf#Inter.: map[string]interface{}{ |
| 130 | "FirstName": "wang", |
| 131 | "LastName": "jl", |
| 132 | "Age": int64(100), |
| 133 | }, |
| 134 | } |
| 135 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, expected, config) |
| 136 | } |
| 137 | |
| 138 | func TestBasicUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestBasicUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 139 | result := basicMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct#{} |
| 140 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(basicTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicTestToml., &result) |
| 141 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 142 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, basicTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicTestData., result) |
| 143 | } |
| 144 | |
| 145 | type quotedKeyMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct# struct { |
| 146 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct#String. string `toml:"Z.string-àéù"` |
| 147 | Floatscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct#Float. float64 `toml:"Yfloat-𝟘"` |
| 148 | Subscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct#Sub. basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# `toml:"Xsubdoc-àéù"` |
| 149 | SubListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct#SubList. []basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# `toml:"W.sublist-𝟘"` |
| 150 | } |
| 151 | |
| 152 | var quotedKeyMarshalTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestData. = quotedKeyMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct#{ |
| 153 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct#String.: "Hello", |
| 154 | Floatscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct#Float.: 3.5, |
| 155 | Subscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct#Sub.: basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{"One"}, |
| 156 | SubListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestStruct#SubList.: []basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{{"Two"}, {"Three"}}, |
| 157 | } |
| 158 | |
| 159 | // TODO: Remove nolint once var is used by a test |
| 160 | // |
| 161 | //nolint:unused |
| 162 | var quotedKeyMarshalTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/quotedKeyMarshalTestToml. = []byte(`"Yfloat-𝟘" = 3.5 |
| 163 | "Z.string-àéù" = "Hello" |
| 164 | |
| 165 | [["W.sublist-𝟘"]] |
| 166 | String2 = "Two" |
| 167 | |
| 168 | [["W.sublist-𝟘"]] |
| 169 | String2 = "Three" |
| 170 | |
| 171 | ["Xsubdoc-àéù"] |
| 172 | String2 = "One" |
| 173 | `) |
| 174 | |
| 175 | type testDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc# struct { |
| 176 | Titlescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#Title. string `toml:"title"` |
| 177 | BasicListsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#BasicLists. testDocBasicListsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists# `toml:"basic_lists"` |
| 178 | SubDocPtrsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#SubDocPtrs. []*testSubDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc# `toml:"subdocptrs"` |
| 179 | BasicMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#BasicMap. map[string]string `toml:"basic_map"` |
| 180 | Subdocsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#Subdocs. testDocSubsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocSubs# `toml:"subdoc"` |
| 181 | Basicsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#Basics. testDocBasicsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics# `toml:"basic"` |
| 182 | SubDocListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#SubDocList. []testSubDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc# `toml:"subdoclist"` |
| 183 | errscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#err. int `toml:"shouldntBeHere"` //nolint:unused |
| 184 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#unexported. int `toml:"shouldntBeHere"` |
| 185 | Unexported2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#Unexported2. int `toml:"-"` |
| 186 | } |
| 187 | |
| 188 | //nolint:unused |
| 189 | type testMapDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testMapDoc# struct { |
| 190 | Titlescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testMapDoc#Title. string `toml:"title"` |
| 191 | BasicMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testMapDoc#BasicMap. map[string]string `toml:"basic_map"` |
| 192 | LongMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testMapDoc#LongMap. map[string]string `toml:"long_map"` |
| 193 | } |
| 194 | |
| 195 | type testDocBasicsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics# struct { |
| 196 | Uintscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Uint. uint `toml:"uint"` |
| 197 | Boolscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Bool. bool `toml:"bool"` |
| 198 | Float32scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Float32. float32 `toml:"float"` |
| 199 | Float64scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Float64. float64 `toml:"float64"` |
| 200 | Intscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Int. int `toml:"int"` |
| 201 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#String. *string `toml:"string"` |
| 202 | Datescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Date. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Timescip-go gomod github.com/golang/go/src go1.21.0 time/Time# `toml:"date"` |
| 203 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#unexported. int `toml:"shouldntBeHere"` |
| 204 | } |
| 205 | |
| 206 | type testDocBasicListsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists# struct { |
| 207 | Floatsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Floats. []*float32 `toml:"floats"` |
| 208 | Boolsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Bools. []bool `toml:"bools"` |
| 209 | Datesscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Dates. []timescip-go gomod github.com/golang/go/src go1.21.0 time/.Timescip-go gomod github.com/golang/go/src go1.21.0 time/Time# `toml:"dates"` |
| 210 | Intsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Ints. []int `toml:"ints"` |
| 211 | UIntsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#UInts. []uint `toml:"uints"` |
| 212 | Stringsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Strings. []string `toml:"strings"` |
| 213 | } |
| 214 | |
| 215 | type testDocSubsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocSubs# struct { |
| 216 | Secondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocSubs#Second. *testSubDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc# `toml:"second"` |
| 217 | Firstscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocSubs#First. testSubDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc# `toml:"first"` |
| 218 | } |
| 219 | |
| 220 | type testSubDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc# struct { |
| 221 | Namescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc#Name. string `toml:"name"` |
| 222 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc#unexported. int `toml:"shouldntBeHere"` |
| 223 | } |
| 224 | |
| 225 | var ( |
| 226 | biteMescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/biteMe. = "Bite me" |
| 227 | float1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/float1. float32 = 12.3 |
| 228 | float2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/float2. float32 = 45.6 |
| 229 | float3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/float3. float32 = 78.9 |
| 230 | subdocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/subdoc. = testSubDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc#{"Second", 0} |
| 231 | ) |
| 232 | |
| 233 | var docDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docData. = testDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#{ |
| 234 | Titlescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#Title.: "TOML Marshal Testing", |
| 235 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#unexported.: 0, |
| 236 | Unexported2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#Unexported2.: 0, |
| 237 | Basicsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#Basics.: testDocBasicsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#{ |
| 238 | Boolscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Bool.: true, |
| 239 | Datescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Date.: timescip-go gomod github.com/golang/go/src go1.21.0 time/.Datescip-go gomod github.com/golang/go/src go1.21.0 time/Date().(1979, 5, 27, 7, 32, 0, 0, timescip-go gomod github.com/golang/go/src go1.21.0 time/.UTCscip-go gomod github.com/golang/go/src go1.21.0 time/UTC.), |
| 240 | Float32scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Float32.: 123.4, |
| 241 | Float64scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Float64.: 123.456782132399, |
| 242 | Intscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Int.: 5000, |
| 243 | Uintscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#Uint.: 5001, |
| 244 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#String.: &biteMescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/biteMe., |
| 245 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasics#unexported.: 0, |
| 246 | }, |
| 247 | BasicListsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#BasicLists.: testDocBasicListsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#{ |
| 248 | Boolsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Bools.: []bool{true, false, true}, |
| 249 | Datesscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Dates.: []timescip-go gomod github.com/golang/go/src go1.21.0 time/.Timescip-go gomod github.com/golang/go/src go1.21.0 time/Time#{ |
| 250 | timescip-go gomod github.com/golang/go/src go1.21.0 time/.Datescip-go gomod github.com/golang/go/src go1.21.0 time/Date().(1979, 5, 27, 7, 32, 0, 0, timescip-go gomod github.com/golang/go/src go1.21.0 time/.UTCscip-go gomod github.com/golang/go/src go1.21.0 time/UTC.), |
| 251 | timescip-go gomod github.com/golang/go/src go1.21.0 time/.Datescip-go gomod github.com/golang/go/src go1.21.0 time/Date().(1980, 5, 27, 7, 32, 0, 0, timescip-go gomod github.com/golang/go/src go1.21.0 time/.UTCscip-go gomod github.com/golang/go/src go1.21.0 time/UTC.), |
| 252 | }, |
| 253 | Floatsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Floats.: []*float32{&float1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/float1., &float2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/float2., &float3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/float3.}, |
| 254 | Intsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Ints.: []int{8001, 8001, 8002}, |
| 255 | Stringsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#Strings.: []string{"One", "Two", "Three"}, |
| 256 | UIntsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicLists#UInts.: []uint{5002, 5003}, |
| 257 | }, |
| 258 | BasicMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#BasicMap.: map[string]string{ |
| 259 | "one": "one", |
| 260 | "two": "two", |
| 261 | }, |
| 262 | Subdocsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#Subdocs.: testDocSubsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocSubs#{ |
| 263 | Firstscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocSubs#First.: testSubDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc#{"First", 0}, |
| 264 | Secondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocSubs#Second.: &subdocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/subdoc., |
| 265 | }, |
| 266 | SubDocListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#SubDocList.: []testSubDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc#{ |
| 267 | {"List.First", 0}, |
| 268 | {"List.Second", 0}, |
| 269 | }, |
| 270 | SubDocPtrsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#SubDocPtrs.: []*testSubDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testSubDoc#{&subdocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/subdoc.}, |
| 271 | } |
| 272 | |
| 273 | // TODO: Remove nolint once var is used by a test |
| 274 | // |
| 275 | //nolint:unused |
| 276 | var mapTestDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapTestDoc. = testMapDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testMapDoc#{ |
| 277 | Titlescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testMapDoc#Title.: "TOML Marshal Testing", |
| 278 | BasicMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testMapDoc#BasicMap.: map[string]string{ |
| 279 | "one": "one", |
| 280 | "two": "two", |
| 281 | }, |
| 282 | LongMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testMapDoc#LongMap.: map[string]string{ |
| 283 | "h1": "8", |
| 284 | "i2": "9", |
| 285 | "b3": "2", |
| 286 | "d4": "4", |
| 287 | "f5": "6", |
| 288 | "e6": "5", |
| 289 | "a7": "1", |
| 290 | "c8": "3", |
| 291 | "j9": "10", |
| 292 | "g10": "7", |
| 293 | }, |
| 294 | } |
| 295 | |
| 296 | func TestDocUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestDocUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 297 | result := testDocscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDoc#{} |
| 298 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(marshalTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/marshalTestToml., &result) |
| 299 | expected := docDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docData. |
| 300 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 301 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, expected, result) |
| 302 | } |
| 303 | |
| 304 | type unexportedMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct# struct { |
| 305 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#String. string `toml:"string"` |
| 306 | StringListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#StringList. []string `toml:"strlist"` |
| 307 | Subscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#Sub. basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# `toml:"subdoc"` |
| 308 | SubListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#SubList. []basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# `toml:"sublist"` |
| 309 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#unexported. int `toml:"shouldntBeHere"` |
| 310 | Unexported2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#Unexported2. int `toml:"-"` |
| 311 | } |
| 312 | |
| 313 | var unexportedTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedTestData. = unexportedMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#{ |
| 314 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#String.: "Hello", |
| 315 | StringListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#StringList.: []string{"Howdy", "Hey There"}, |
| 316 | Subscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#Sub.: basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{"One"}, |
| 317 | SubListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#SubList.: []basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{{"Two"}, {"Three"}}, |
| 318 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#unexported.: 0, |
| 319 | Unexported2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#Unexported2.: 0, |
| 320 | } |
| 321 | |
| 322 | var unexportedTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedTestToml. = []byte(`string = "Hello" |
| 323 | strlist = ["Howdy","Hey There"] |
| 324 | unexported = 1 |
| 325 | shouldntBeHere = 2 |
| 326 | |
| 327 | [subdoc] |
| 328 | String2 = "One" |
| 329 | |
| 330 | [[sublist]] |
| 331 | String2 = "Two" |
| 332 | |
| 333 | [[sublist]] |
| 334 | String2 = "Three" |
| 335 | `) |
| 336 | |
| 337 | func TestUnexportedUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnexportedUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 338 | result := unexportedMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedMarshalTestStruct#{} |
| 339 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(unexportedTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedTestToml., &result) |
| 340 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 341 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, unexportedTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedTestData., result) |
| 342 | } |
| 343 | |
| 344 | type errStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/errStruct# struct { |
| 345 | Boolscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/errStruct#Bool. bool `toml:"bool"` |
| 346 | Datescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/errStruct#Date. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Timescip-go gomod github.com/golang/go/src go1.21.0 time/Time# `toml:"date"` |
| 347 | Floatscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/errStruct#Float. float64 `toml:"float"` |
| 348 | Intscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/errStruct#Int. int16 `toml:"int"` |
| 349 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/errStruct#String. *string `toml:"string"` |
| 350 | } |
| 351 | |
| 352 | type mapErrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapErr# struct { |
| 353 | Valsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapErr#Vals. map[string]float64 |
| 354 | } |
| 355 | |
| 356 | type intErrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr# struct { |
| 357 | Int1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#Int1. int |
| 358 | Int2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#Int2. int8 |
| 359 | Int3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#Int3. int16 |
| 360 | Int4scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#Int4. int32 |
| 361 | Int5scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#Int5. int64 |
| 362 | UInt1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#UInt1. uint |
| 363 | UInt2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#UInt2. uint8 |
| 364 | UInt3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#UInt3. uint16 |
| 365 | UInt4scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#UInt4. uint32 |
| 366 | UInt5scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#UInt5. uint64 |
| 367 | Flt1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#Flt1. float32 |
| 368 | Flt2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#Flt2. float64 |
| 369 | } |
| 370 | |
| 371 | var intErrTomlsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErrTomls. = []string{ |
| 372 | "Int1 = []\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0", |
| 373 | "Int1 = 1\nInt2 = []\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0", |
| 374 | "Int1 = 1\nInt2 = 2\nInt3 = []\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0", |
| 375 | "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = []\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0", |
| 376 | "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = []\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0", |
| 377 | "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = []\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0", |
| 378 | "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = []\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0", |
| 379 | "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = []\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0", |
| 380 | "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = []\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0", |
| 381 | "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = []\nFlt1 = 1.0\nFlt2 = 2.0", |
| 382 | "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = []\nFlt2 = 2.0", |
| 383 | "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = []", |
| 384 | } |
| 385 | |
| 386 | func TestErrUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestErrUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 387 | errTomls := []string{ |
| 388 | "bool = truly\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = \"Bite me\"", |
| 389 | "bool = true\ndate = 1979-05-27T07:3200Z\nfloat = 123.4\nint = 5000\nstring = \"Bite me\"", |
| 390 | "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123a4\nint = 5000\nstring = \"Bite me\"", |
| 391 | "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = j000\nstring = \"Bite me\"", |
| 392 | "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = Bite me", |
| 393 | "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = Bite me", |
| 394 | "bool = 1\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = \"Bite me\"", |
| 395 | "bool = true\ndate = 1\nfloat = 123.4\nint = 5000\nstring = \"Bite me\"", |
| 396 | "bool = true\ndate = 1979-05-27T07:32:00Z\n\"sorry\"\nint = 5000\nstring = \"Bite me\"", |
| 397 | "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = \"sorry\"\nstring = \"Bite me\"", |
| 398 | "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = 1", |
| 399 | } |
| 400 | |
| 401 | for ind, x := range errTomls { |
| 402 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().("Base Case %d", ind), func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 403 | result := errStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/errStruct#{} |
| 404 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(x), &result) |
| 405 | if err == nil { |
| 406 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Expected err from case %d\n", ind) |
| 407 | } |
| 408 | }) |
| 409 | } |
| 410 | result2 := mapErrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapErr#{} |
| 411 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte("[Vals]\nfred=\"1.2\""), &result2) |
| 412 | if err == nil { |
| 413 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Expected err from map") |
| 414 | } |
| 415 | for ind, x := range intErrTomlsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErrTomls. { |
| 416 | result3 := intErrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intErr#{} |
| 417 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(x), &result3) |
| 418 | if err == nil { |
| 419 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Expected int err from case %d\n", ind) |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | var emptyTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/emptyTestToml. = []byte(`bool = false |
| 425 | int = 0 |
| 426 | string = "" |
| 427 | stringlist = [] |
| 428 | title = "Placeholder" |
| 429 | |
| 430 | [map] |
| 431 | `) |
| 432 | |
| 433 | func TestEmptytomlUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestEmptytomlUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 434 | type emptyMarshalTestStruct struct { |
| 435 | Title string `toml:"title"` |
| 436 | Bool bool `toml:"bool"` |
| 437 | Int int `toml:"int"` |
| 438 | String string `toml:"string"` |
| 439 | StringList []string `toml:"stringlist"` |
| 440 | Ptr *basicMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestStruct# `toml:"ptr"` |
| 441 | Map map[string]string `toml:"map"` |
| 442 | } |
| 443 | |
| 444 | emptyTestData := emptyMarshalTestStruct{ |
| 445 | Title: "Placeholder", |
| 446 | Bool: false, |
| 447 | Int: 0, |
| 448 | String: "", |
| 449 | StringList: []string{}, |
| 450 | Ptr: nil, |
| 451 | Map: nil, |
| 452 | } |
| 453 | |
| 454 | result := emptyMarshalTestStruct{} |
| 455 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(emptyTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/emptyTestToml., &result) |
| 456 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 457 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, emptyTestData, result) |
| 458 | } |
| 459 | |
| 460 | type pointerMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct# struct { |
| 461 | Strscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#Str. *string |
| 462 | Listscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#List. *[]string |
| 463 | ListPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#ListPtr. *[]*string |
| 464 | Mapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#Map. *map[string]string |
| 465 | MapPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#MapPtr. *map[string]*string |
| 466 | EmptyStrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#EmptyStr. *string |
| 467 | EmptyListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#EmptyList. *[]string |
| 468 | EmptyMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#EmptyMap. *map[string]string |
| 469 | DblPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#DblPtr. *[]*[]*string |
| 470 | } |
| 471 | |
| 472 | var ( |
| 473 | pointerStrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerStr. = "Hello" |
| 474 | pointerListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerList. = []string{"Hello back"} |
| 475 | pointerListPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerListPtr. = []*string{&pointerStrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerStr.} |
| 476 | pointerMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMap. = map[string]string{"response": "Goodbye"} |
| 477 | pointerMapPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMapPtr. = map[string]*string{"alternate": &pointerStrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerStr.} |
| 478 | pointerTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerTestData. = pointerMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#{ |
| 479 | Strscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#Str.: &pointerStrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerStr., |
| 480 | Listscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#List.: &pointerListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerList., |
| 481 | ListPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#ListPtr.: &pointerListPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerListPtr., |
| 482 | Mapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#Map.: &pointerMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMap., |
| 483 | MapPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#MapPtr.: &pointerMapPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMapPtr., |
| 484 | EmptyStrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#EmptyStr.: nil, |
| 485 | EmptyListscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#EmptyList.: nil, |
| 486 | EmptyMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#EmptyMap.: nil, |
| 487 | } |
| 488 | ) |
| 489 | |
| 490 | var pointerTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerTestToml. = []byte(`List = ["Hello back"] |
| 491 | ListPtr = ["Hello"] |
| 492 | Str = "Hello" |
| 493 | |
| 494 | [Map] |
| 495 | response = "Goodbye" |
| 496 | |
| 497 | [MapPtr] |
| 498 | alternate = "Hello" |
| 499 | `) |
| 500 | |
| 501 | func TestPointerUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestPointerUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 502 | result := pointerMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#{} |
| 503 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(pointerTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerTestToml., &result) |
| 504 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 505 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, pointerTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerTestData., result) |
| 506 | } |
| 507 | |
| 508 | func TestUnmarshalTypeMismatchscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalTypeMismatch().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 509 | result := pointerMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/pointerMarshalTestStruct#{} |
| 510 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte("List = 123"), &result) |
| 511 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, err) |
| 512 | } |
| 513 | |
| 514 | type nestedMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedMarshalTestStruct# struct { |
| 515 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedMarshalTestStruct#String. [][]string |
| 516 | // Struct [][]basicMarshalTestSubStruct |
| 517 | StringPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedMarshalTestStruct#StringPtr. *[]*[]*string |
| 518 | // StructPtr *[]*[]*basicMarshalTestSubStruct |
| 519 | } |
| 520 | |
| 521 | var ( |
| 522 | str1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/str1. = "Three" |
| 523 | str2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/str2. = "Four" |
| 524 | strPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/strPtr. = []*string{&str1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/str1., &str2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/str2.} |
| 525 | strPtr2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/strPtr2. = []*[]*string{&strPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/strPtr.} |
| 526 | ) |
| 527 | |
| 528 | var nestedTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedTestData. = nestedMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedMarshalTestStruct#{ |
| 529 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedMarshalTestStruct#String.: [][]string{{"Five", "Six"}, {"One", "Two"}}, |
| 530 | StringPtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedMarshalTestStruct#StringPtr.: &strPtr2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/strPtr2., |
| 531 | } |
| 532 | |
| 533 | var nestedTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedTestToml. = []byte(`String = [["Five", "Six"], ["One", "Two"]] |
| 534 | StringPtr = [["Three", "Four"]] |
| 535 | `) |
| 536 | |
| 537 | func TestNestedUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestNestedUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 538 | result := nestedMarshalTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedMarshalTestStruct#{} |
| 539 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(nestedTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedTestToml., &result) |
| 540 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 541 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, nestedTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedTestData., result) |
| 542 | } |
| 543 | |
| 544 | //nolint:unused |
| 545 | type customMarshalerParentscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshalerParent# struct { |
| 546 | Selfscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshalerParent#Self. customMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler# `toml:"me"` |
| 547 | Friendsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshalerParent#Friends. []customMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler# `toml:"friends"` |
| 548 | } |
| 549 | |
| 550 | //nolint:unused |
| 551 | type customMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler# struct { |
| 552 | FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#FirstName. string |
| 553 | LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#LastName. string |
| 554 | } |
| 555 | |
| 556 | //nolint:unused |
| 557 | func (c customMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#) MarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#MarshalTOML().() ([]byte, error) { |
| 558 | fullName := fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().("%s %s", c.FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#FirstName., c.LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#LastName.) |
| 559 | return []byte(fullName), nil |
| 560 | } |
| 561 | |
| 562 | //nolint:unused |
| 563 | var customMarshalerDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshalerData. = customMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#{FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#FirstName.: "Sally", LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#LastName.: "Fields"} |
| 564 | |
| 565 | // TODO: Remove nolint once var is used by a test |
| 566 | // |
| 567 | //nolint:unused |
| 568 | var customMarshalerTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshalerToml. = []byte(`Sally Fields`) |
| 569 | |
| 570 | // TODO: Remove nolint once var is used by a test |
| 571 | // |
| 572 | //nolint:unused |
| 573 | var nestedCustomMarshalerDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedCustomMarshalerData. = customMarshalerParentscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshalerParent#{ |
| 574 | Selfscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshalerParent#Self.: customMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#{FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#FirstName.: "Maiku", LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#LastName.: "Suteda"}, |
| 575 | Friendsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshalerParent#Friends.: []customMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshaler#{customMarshalerDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMarshalerData.}, |
| 576 | } |
| 577 | |
| 578 | // TODO: Remove nolint once var is used by a test |
| 579 | // |
| 580 | //nolint:unused |
| 581 | var nestedCustomMarshalerTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedCustomMarshalerToml. = []byte(`friends = ["Sally Fields"] |
| 582 | me = "Maiku Suteda" |
| 583 | `) |
| 584 | |
| 585 | var nestedCustomMarshalerTomlForUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedCustomMarshalerTomlForUnmarshal. = []byte(`[friends] |
| 586 | FirstName = "Sally" |
| 587 | LastName = "Fields"`) |
| 588 | |
| 589 | type IntOrStringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/IntOrString# string |
| 590 | |
| 591 | func (x *IntOrStringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/IntOrString#) MarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/IntOrString#MarshalTOML().() ([]byte, error) { |
| 592 | s := *(*string)(x) |
| 593 | _, err := strconvscip-go gomod github.com/golang/go/src go1.21.0 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.21.0 strconv/Atoi().(s) |
| 594 | if err != nil { |
| 595 | return []byte(fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().(`"%s"`, s)), nil //nolint:nilerr |
| 596 | } |
| 597 | return []byte(s), nil |
| 598 | } |
| 599 | |
| 600 | func TestUnmarshalTextMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalTextMarshaler().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 601 | nested := struct { |
| 602 | Friends textMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textMarshaler# `toml:"friends"` |
| 603 | }{} |
| 604 | |
| 605 | expected := struct { |
| 606 | Friends textMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textMarshaler# `toml:"friends"` |
| 607 | }{ |
| 608 | Friends: textMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textMarshaler#{FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textMarshaler#FirstName.: "Sally", LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textMarshaler#LastName.: "Fields"}, |
| 609 | } |
| 610 | |
| 611 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(nestedCustomMarshalerTomlForUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/nestedCustomMarshalerTomlForUnmarshal., &nested) |
| 612 | if err != nil { |
| 613 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 614 | } |
| 615 | if !reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21.0 reflect/DeepEqual().(nested, expected) { |
| 616 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Bad unmarshal: expected %v, got %v", expected, nested) |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | // TODO: Remove nolint once type and methods are used by a test |
| 621 | // |
| 622 | //nolint:unused |
| 623 | type precedentMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/precedentMarshaler# struct { |
| 624 | FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/precedentMarshaler#FirstName. string |
| 625 | LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/precedentMarshaler#LastName. string |
| 626 | } |
| 627 | |
| 628 | //nolint:unused |
| 629 | func (m precedentMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/precedentMarshaler#) MarshalTextscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/precedentMarshaler#MarshalText().() ([]byte, error) { |
| 630 | return []byte("shadowed"), nil |
| 631 | } |
| 632 | |
| 633 | //nolint:unused |
| 634 | func (m precedentMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/precedentMarshaler#) MarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/precedentMarshaler#MarshalTOML().() ([]byte, error) { |
| 635 | fullName := fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().("%s %s", m.FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/precedentMarshaler#FirstName., m.LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/precedentMarshaler#LastName.) |
| 636 | return []byte(fullName), nil |
| 637 | } |
| 638 | |
| 639 | // TODO: Remove nolint once type and method are used by a test |
| 640 | // |
| 641 | //nolint:unused |
| 642 | type customPointerMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customPointerMarshaler# struct { |
| 643 | FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customPointerMarshaler#FirstName. string |
| 644 | LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customPointerMarshaler#LastName. string |
| 645 | } |
| 646 | |
| 647 | //nolint:unused |
| 648 | func (m *customPointerMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customPointerMarshaler#) MarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customPointerMarshaler#MarshalTOML().() ([]byte, error) { |
| 649 | return []byte(`"hidden"`), nil |
| 650 | } |
| 651 | |
| 652 | // TODO: Remove nolint once type and method are used by a test |
| 653 | // |
| 654 | //nolint:unused |
| 655 | type textPointerMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textPointerMarshaler# struct { |
| 656 | FirstNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textPointerMarshaler#FirstName. string |
| 657 | LastNamescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textPointerMarshaler#LastName. string |
| 658 | } |
| 659 | |
| 660 | //nolint:unused |
| 661 | func (m *textPointerMarshalerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textPointerMarshaler#) MarshalTextscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/textPointerMarshaler#MarshalText().() ([]byte, error) { |
| 662 | return []byte("hidden"), nil |
| 663 | } |
| 664 | |
| 665 | // TODO: Remove nolint once var is used by a test |
| 666 | // |
| 667 | //nolint:unused |
| 668 | var commentTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/commentTestToml. = []byte(` |
| 669 | # it's a comment on type |
| 670 | [postgres] |
| 671 | # isCommented = "dvalue" |
| 672 | noComment = "cvalue" |
| 673 | |
| 674 | # A comment on AttrB with a |
| 675 | # break line |
| 676 | password = "bvalue" |
| 677 | |
| 678 | # A comment on AttrA |
| 679 | user = "avalue" |
| 680 | |
| 681 | [[postgres.My]] |
| 682 | |
| 683 | # a comment on my on typeC |
| 684 | My = "Foo" |
| 685 | |
| 686 | [[postgres.My]] |
| 687 | |
| 688 | # a comment on my on typeC |
| 689 | My = "Baar" |
| 690 | `) |
| 691 | |
| 692 | //nolint:unused |
| 693 | type mapsTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct# struct { |
| 694 | Simplescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#Simple. map[string]string |
| 695 | Pathsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#Paths. map[string]string |
| 696 | Otherscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#Other. map[string]float64 |
| 697 | Xscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#X. struct { |
| 698 | Yscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#$anon_73b7e0c641b2728a#Y. struct { |
| 699 | Zscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#$anon_73b7e0c641b2728a#$anon_cb1d4527731190ae#Z. map[string]bool |
| 700 | } |
| 701 | } |
| 702 | } |
| 703 | |
| 704 | // TODO: Remove nolint once var is used by a test |
| 705 | // |
| 706 | //nolint:unused |
| 707 | var mapsTestDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestData. = mapsTestStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#{ |
| 708 | Simplescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#Simple.: map[string]string{ |
| 709 | "one plus one": "two", |
| 710 | "next": "three", |
| 711 | }, |
| 712 | Pathsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#Paths.: map[string]string{ |
| 713 | "/this/is/a/path": "/this/is/also/a/path", |
| 714 | "/heloo.txt": "/tmp/lololo.txt", |
| 715 | }, |
| 716 | Otherscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#Other.: map[string]float64{ |
| 717 | "testing": 3.9999, |
| 718 | }, |
| 719 | Xscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestStruct#X.: struct{ Yscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestData:Y. struct{ Zscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestData:$anon_cb1d4527731190ae#Z. map[string]bool } }{ |
| 720 | Yscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestData:Y.: struct{ Zscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestData:Z. map[string]bool }{ |
| 721 | Zscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestData:Z.: map[string]bool{ |
| 722 | "is.Nested": true, |
| 723 | }, |
| 724 | }, |
| 725 | }, |
| 726 | } |
| 727 | |
| 728 | // TODO: Remove nolint once var is used by a test |
| 729 | // |
| 730 | //nolint:unused |
| 731 | var mapsTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/mapsTestToml. = []byte(` |
| 732 | [Other] |
| 733 | "testing" = 3.9999 |
| 734 | |
| 735 | [Paths] |
| 736 | "/heloo.txt" = "/tmp/lololo.txt" |
| 737 | "/this/is/a/path" = "/this/is/also/a/path" |
| 738 | |
| 739 | [Simple] |
| 740 | "next" = "three" |
| 741 | "one plus one" = "two" |
| 742 | |
| 743 | [X] |
| 744 | |
| 745 | [X.Y] |
| 746 | |
| 747 | [X.Y.Z] |
| 748 | "is.Nested" = true |
| 749 | `) |
| 750 | |
| 751 | // TODO: Remove nolint once type is used by a test |
| 752 | // |
| 753 | //nolint:unused |
| 754 | type structArrayNoTagscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/structArrayNoTag# struct { |
| 755 | Ascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/structArrayNoTag#A. struct { |
| 756 | Bscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/structArrayNoTag#$anon_bb3878c30fb72842#B. []int64 |
| 757 | Cscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/structArrayNoTag#$anon_bb3878c30fb72842#C. []int64 |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | // TODO: Remove nolint once var is used by a test |
| 762 | // |
| 763 | //nolint:unused |
| 764 | var customTagTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customTagTestToml. = []byte(` |
| 765 | [postgres] |
| 766 | password = "bvalue" |
| 767 | user = "avalue" |
| 768 | |
| 769 | [[postgres.My]] |
| 770 | My = "Foo" |
| 771 | |
| 772 | [[postgres.My]] |
| 773 | My = "Baar" |
| 774 | `) |
| 775 | |
| 776 | // TODO: Remove nolint once var is used by a test |
| 777 | // |
| 778 | //nolint:unused |
| 779 | var customCommentTagTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customCommentTagTestToml. = []byte(` |
| 780 | # db connection |
| 781 | [postgres] |
| 782 | |
| 783 | # db pass |
| 784 | password = "bvalue" |
| 785 | |
| 786 | # db user |
| 787 | user = "avalue" |
| 788 | `) |
| 789 | |
| 790 | // TODO: Remove nolint once var is used by a test |
| 791 | // |
| 792 | //nolint:unused |
| 793 | var customCommentedTagTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customCommentedTagTestToml. = []byte(` |
| 794 | [postgres] |
| 795 | # password = "bvalue" |
| 796 | # user = "avalue" |
| 797 | `) |
| 798 | |
| 799 | func TestUnmarshalTabInStringAndQuotedKeyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalTabInStringAndQuotedKey().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 800 | type Test struct { |
| 801 | Field1 string `toml:"Fie ld1"` |
| 802 | Field2 string |
| 803 | } |
| 804 | |
| 805 | type TestCase struct { |
| 806 | desc string |
| 807 | input []byte |
| 808 | expected Test |
| 809 | } |
| 810 | |
| 811 | testCases := []TestCase{ |
| 812 | { |
| 813 | desc: "multiline string with tab", |
| 814 | input: []byte("Field2 = \"\"\"\nhello\tworld\"\"\""), |
| 815 | expected: Test{ |
| 816 | Field2: "hello\tworld", |
| 817 | }, |
| 818 | }, |
| 819 | { |
| 820 | desc: "quoted key with tab", |
| 821 | input: []byte("\"Fie\tld1\" = \"key with tab\""), |
| 822 | expected: Test{ |
| 823 | Field1: "key with tab", |
| 824 | }, |
| 825 | }, |
| 826 | { |
| 827 | desc: "basic string tab", |
| 828 | input: []byte("Field2 = \"hello\tworld\""), |
| 829 | expected: Test{ |
| 830 | Field2: "hello\tworld", |
| 831 | }, |
| 832 | }, |
| 833 | } |
| 834 | |
| 835 | for _, test := range testCases { |
| 836 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().(test.desc, func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 837 | result := Test{} |
| 838 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(test.input, &result) |
| 839 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 840 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, test.expected, result) |
| 841 | }) |
| 842 | } |
| 843 | } |
| 844 | |
| 845 | // TODO: Remove nolint once var is used by a test |
| 846 | // |
| 847 | //nolint:unused |
| 848 | var customMultilineTagTestTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/customMultilineTagTestToml. = []byte(`int_slice = [ |
| 849 | 1, |
| 850 | 2, |
| 851 | 3, |
| 852 | ] |
| 853 | `) |
| 854 | |
| 855 | // TODO: Remove nolint once var is used by a test |
| 856 | // |
| 857 | //nolint:unused |
| 858 | var testDocBasicTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicToml. = []byte(` |
| 859 | [document] |
| 860 | bool_val = true |
| 861 | date_val = 1979-05-27T07:32:00Z |
| 862 | float_val = 123.4 |
| 863 | int_val = 5000 |
| 864 | string_val = "Bite me" |
| 865 | uint_val = 5001 |
| 866 | `) |
| 867 | |
| 868 | //nolint:unused |
| 869 | type testDocCustomTagscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocCustomTag# struct { |
| 870 | Docscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocCustomTag#Doc. testDocBasicsCustomTagscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag# `file:"document"` |
| 871 | } |
| 872 | |
| 873 | //nolint:unused |
| 874 | type testDocBasicsCustomTagscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag# struct { |
| 875 | Boolscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Bool. bool `file:"bool_val"` |
| 876 | Datescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Date. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Timescip-go gomod github.com/golang/go/src go1.21.0 time/Time# `file:"date_val"` |
| 877 | Floatscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Float. float32 `file:"float_val"` |
| 878 | Intscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Int. int `file:"int_val"` |
| 879 | Uintscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Uint. uint `file:"uint_val"` |
| 880 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#String. *string `file:"string_val"` |
| 881 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#unexported. int `file:"shouldntBeHere"` |
| 882 | } |
| 883 | |
| 884 | //nolint:unused |
| 885 | var testDocCustomTagDatascip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocCustomTagData. = testDocCustomTagscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocCustomTag#{ |
| 886 | Docscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocCustomTag#Doc.: testDocBasicsCustomTagscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#{ |
| 887 | Boolscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Bool.: true, |
| 888 | Datescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Date.: timescip-go gomod github.com/golang/go/src go1.21.0 time/.Datescip-go gomod github.com/golang/go/src go1.21.0 time/Date().(1979, 5, 27, 7, 32, 0, 0, timescip-go gomod github.com/golang/go/src go1.21.0 time/.UTCscip-go gomod github.com/golang/go/src go1.21.0 time/UTC.), |
| 889 | Floatscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Float.: 123.4, |
| 890 | Intscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Int.: 5000, |
| 891 | Uintscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#Uint.: 5001, |
| 892 | Stringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#String.: &biteMescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/biteMe., |
| 893 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDocBasicsCustomTag#unexported.: 0, |
| 894 | }, |
| 895 | } |
| 896 | |
| 897 | func TestUnmarshalMapscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalMap().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 898 | testToml := []byte(` |
| 899 | a = 1 |
| 900 | b = 2 |
| 901 | c = 3 |
| 902 | `) |
| 903 | var result map[string]int |
| 904 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(testToml, &result) |
| 905 | if err != nil { |
| 906 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Received unexpected error: %s", err) |
| 907 | return |
| 908 | } |
| 909 | |
| 910 | expected := map[string]int{ |
| 911 | "a": 1, |
| 912 | "b": 2, |
| 913 | "c": 3, |
| 914 | } |
| 915 | |
| 916 | if !reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21.0 reflect/DeepEqual().(result, expected) { |
| 917 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Bad unmarshal: expected %v, got %v", expected, result) |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | func TestUnmarshalMapWithTypedKeyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalMapWithTypedKey().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 922 | testToml := []byte(` |
| 923 | a = 1 |
| 924 | b = 2 |
| 925 | c = 3 |
| 926 | `) |
| 927 | |
| 928 | type letter string |
| 929 | var result map[letter]int |
| 930 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(testToml, &result) |
| 931 | if err != nil { |
| 932 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Received unexpected error: %s", err) |
| 933 | return |
| 934 | } |
| 935 | |
| 936 | expected := map[letter]int{ |
| 937 | "a": 1, |
| 938 | "b": 2, |
| 939 | "c": 3, |
| 940 | } |
| 941 | |
| 942 | if !reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21.0 reflect/DeepEqual().(result, expected) { |
| 943 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Bad unmarshal: expected %v, got %v", expected, result) |
| 944 | } |
| 945 | } |
| 946 | |
| 947 | func TestUnmarshalTypeTableHeaderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalTypeTableHeader().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 948 | testToml := []byte(` |
| 949 | [test] |
| 950 | a = 1 |
| 951 | `) |
| 952 | |
| 953 | type header string |
| 954 | var result map[header]map[string]int |
| 955 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(testToml, &result) |
| 956 | if err != nil { |
| 957 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Received unexpected error: %s", err) |
| 958 | return |
| 959 | } |
| 960 | |
| 961 | expected := map[header]map[string]int{ |
| 962 | "test": {"a": 1}, |
| 963 | } |
| 964 | |
| 965 | if !reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21.0 reflect/DeepEqual().(result, expected) { |
| 966 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Bad unmarshal: expected %v, got %v", expected, result) |
| 967 | } |
| 968 | } |
| 969 | |
| 970 | func TestUnmarshalNonPointerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalNonPointer().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 971 | a := 1 |
| 972 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte{}, a) |
| 973 | if err == nil { |
| 974 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("unmarshal should err when given a non pointer") |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | func TestUnmarshalInvalidPointerKindscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalInvalidPointerKind().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 979 | t.Skipfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Skipf().("should this really be an error?") |
| 980 | a := 1 |
| 981 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte{}, &a) |
| 982 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, err) |
| 983 | } |
| 984 | |
| 985 | // TODO: Remove nolint once var is used by a test |
| 986 | // |
| 987 | //nolint:unused |
| 988 | type testDurationscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration# struct { |
| 989 | Nanosecscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration#Nanosec. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `toml:"nanosec"` |
| 990 | Microsec1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration#Microsec1. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `toml:"microsec1"` |
| 991 | Microsec2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration#Microsec2. *timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `toml:"microsec2"` |
| 992 | Millisecscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration#Millisec. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `toml:"millisec"` |
| 993 | Secscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration#Sec. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `toml:"sec"` //nolint:staticcheck |
| 994 | Minscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration#Min. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `toml:"min"` |
| 995 | Hourscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration#Hour. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `toml:"hour"` |
| 996 | Mixedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration#Mixed. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `toml:"mixed"` |
| 997 | AStringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDuration#AString. string `toml:"a_string"` |
| 998 | } |
| 999 | |
| 1000 | // TODO: Remove nolint once var is used by a test |
| 1001 | // |
| 1002 | //nolint:unused |
| 1003 | var testDurationTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDurationToml. = []byte(` |
| 1004 | nanosec = "1ns" |
| 1005 | microsec1 = "1us" |
| 1006 | microsec2 = "1µs" |
| 1007 | millisec = "1ms" |
| 1008 | sec = "1s" |
| 1009 | min = "1m" |
| 1010 | hour = "1h" |
| 1011 | mixed = "1h1m1s1ms1µs1ns" |
| 1012 | a_string = "15s" |
| 1013 | `) |
| 1014 | |
| 1015 | // TODO: Remove nolint once var is used by a test |
| 1016 | // |
| 1017 | //nolint:unused |
| 1018 | var testDurationToml2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testDurationToml2. = []byte(`a_string = "15s" |
| 1019 | hour = "1h0m0s" |
| 1020 | microsec1 = "1µs" |
| 1021 | microsec2 = "1µs" |
| 1022 | millisec = "1ms" |
| 1023 | min = "1m0s" |
| 1024 | mixed = "1h1m1.001001001s" |
| 1025 | nanosec = "1ns" |
| 1026 | sec = "1s" |
| 1027 | `) |
| 1028 | |
| 1029 | // TODO: Remove nolint once type is used by a test |
| 1030 | // |
| 1031 | //nolint:unused |
| 1032 | type testBadDurationscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testBadDuration# struct { |
| 1033 | Valscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testBadDuration#Val. timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `toml:"val"` |
| 1034 | } |
| 1035 | |
| 1036 | // TODO: add back camelCase test |
| 1037 | var testCamelCaseKeyTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testCamelCaseKeyToml. = []byte(`fooBar = 10`) |
| 1038 | |
| 1039 | func TestUnmarshalCamelCaseKeyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalCamelCaseKey().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1040 | t.Skipfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Skipf().("don't know if it is a good idea to automatically convert like that yet") |
| 1041 | var x struct { |
| 1042 | FooBar int |
| 1043 | B int |
| 1044 | } |
| 1045 | |
| 1046 | if err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(testCamelCaseKeyTomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/testCamelCaseKeyToml., &x); err != nil { |
| 1047 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 1048 | } |
| 1049 | |
| 1050 | if x.FooBar != 10 { |
| 1051 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("Did not set camelCase'd key") |
| 1052 | } |
| 1053 | } |
| 1054 | |
| 1055 | func TestUnmarshalNegativeUintscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalNegativeUint().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1056 | t.Skipfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Skipf().("not sure if we this should always error") |
| 1057 | type check struct{ U uint } |
| 1058 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte("U = -1"), &check{}) |
| 1059 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, err) |
| 1060 | } |
| 1061 | |
| 1062 | func TestUnmarshalCheckConversionFloatIntscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalCheckConversionFloatInt().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1063 | type conversionCheck struct { |
| 1064 | U uint |
| 1065 | I int |
| 1066 | F float64 |
| 1067 | } |
| 1068 | |
| 1069 | type TestCase struct { |
| 1070 | desc string |
| 1071 | input string |
| 1072 | } |
| 1073 | |
| 1074 | testCases := []TestCase{ |
| 1075 | { |
| 1076 | desc: "unsigned int", |
| 1077 | input: `U = 1e300`, |
| 1078 | }, |
| 1079 | { |
| 1080 | desc: "int", |
| 1081 | input: `I = 1e300`, |
| 1082 | }, |
| 1083 | } |
| 1084 | |
| 1085 | for _, test := range testCases { |
| 1086 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().(test.desc, func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1087 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(test.input), &conversionCheck{}) |
| 1088 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, err) |
| 1089 | }) |
| 1090 | } |
| 1091 | } |
| 1092 | |
| 1093 | func TestUnmarshalOverflowscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalOverflow().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1094 | type overflow struct { |
| 1095 | U8 uint8 |
| 1096 | I8 int8 |
| 1097 | F32 float32 |
| 1098 | } |
| 1099 | |
| 1100 | type TestCase struct { |
| 1101 | desc string |
| 1102 | input string |
| 1103 | } |
| 1104 | |
| 1105 | testCases := []TestCase{ |
| 1106 | { |
| 1107 | desc: "byte", |
| 1108 | input: `U8 = 300`, |
| 1109 | }, |
| 1110 | { |
| 1111 | desc: "int8", |
| 1112 | input: `I8 = 300`, |
| 1113 | }, |
| 1114 | { |
| 1115 | desc: "float32", |
| 1116 | input: `F32 = 1e300`, |
| 1117 | }, |
| 1118 | } |
| 1119 | |
| 1120 | for _, test := range testCases { |
| 1121 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().(test.desc, func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1122 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(test.input), &overflow{}) |
| 1123 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, err) |
| 1124 | }) |
| 1125 | } |
| 1126 | } |
| 1127 | |
| 1128 | func TestUnmarshalDefaultscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalDefault().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1129 | t.Skipfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Skipf().("don't know if it is a good idea to have `default`") |
| 1130 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("main", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1131 | type EmbeddedStruct struct { |
| 1132 | StringField string `default:"c"` |
| 1133 | } |
| 1134 | |
| 1135 | type aliasUint uint |
| 1136 | |
| 1137 | var doc struct { |
| 1138 | StringField string `default:"a"` |
| 1139 | BoolField bool `default:"true"` |
| 1140 | UintField uint `default:"1"` |
| 1141 | Uint8Field uint8 `default:"8"` |
| 1142 | Uint16Field uint16 `default:"16"` |
| 1143 | Uint32Field uint32 `default:"32"` |
| 1144 | Uint64Field uint64 `default:"64"` |
| 1145 | IntField int `default:"-1"` |
| 1146 | Int8Field int8 `default:"-8"` |
| 1147 | Int16Field int16 `default:"-16"` |
| 1148 | Int32Field int32 `default:"-32"` |
| 1149 | Int64Field int64 `default:"-64"` |
| 1150 | Float32Field float32 `default:"32.1"` |
| 1151 | Float64Field float64 `default:"64.1"` |
| 1152 | DurationField timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `default:"120ms"` |
| 1153 | DurationField2 timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `default:"120000000"` |
| 1154 | NonEmbeddedStruct struct { |
| 1155 | StringField string `default:"b"` |
| 1156 | } |
| 1157 | EmbeddedStruct |
| 1158 | AliasUintField aliasUint `default:"1000"` |
| 1159 | } |
| 1160 | |
| 1161 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(``), &doc) |
| 1162 | if err != nil { |
| 1163 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 1164 | } |
| 1165 | if doc.BoolField != true { |
| 1166 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("BoolField should be true, not %t", doc.BoolField) |
| 1167 | } |
| 1168 | if doc.StringField != "a" { |
| 1169 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("StringField should be \"a\", not %s", doc.StringField) |
| 1170 | } |
| 1171 | if doc.UintField != 1 { |
| 1172 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("UintField should be 1, not %d", doc.UintField) |
| 1173 | } |
| 1174 | if doc.Uint8Field != 8 { |
| 1175 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Uint8Field should be 8, not %d", doc.Uint8Field) |
| 1176 | } |
| 1177 | if doc.Uint16Field != 16 { |
| 1178 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Uint16Field should be 16, not %d", doc.Uint16Field) |
| 1179 | } |
| 1180 | if doc.Uint32Field != 32 { |
| 1181 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Uint32Field should be 32, not %d", doc.Uint32Field) |
| 1182 | } |
| 1183 | if doc.Uint64Field != 64 { |
| 1184 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Uint64Field should be 64, not %d", doc.Uint64Field) |
| 1185 | } |
| 1186 | if doc.IntField != -1 { |
| 1187 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("IntField should be -1, not %d", doc.IntField) |
| 1188 | } |
| 1189 | if doc.Int8Field != -8 { |
| 1190 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Int8Field should be -8, not %d", doc.Int8Field) |
| 1191 | } |
| 1192 | if doc.Int16Field != -16 { |
| 1193 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Int16Field should be -16, not %d", doc.Int16Field) |
| 1194 | } |
| 1195 | if doc.Int32Field != -32 { |
| 1196 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Int32Field should be -32, not %d", doc.Int32Field) |
| 1197 | } |
| 1198 | if doc.Int64Field != -64 { |
| 1199 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Int64Field should be -64, not %d", doc.Int64Field) |
| 1200 | } |
| 1201 | if doc.Float32Field != 32.1 { |
| 1202 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Float32Field should be 32.1, not %f", doc.Float32Field) |
| 1203 | } |
| 1204 | if doc.Float64Field != 64.1 { |
| 1205 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Float64Field should be 64.1, not %f", doc.Float64Field) |
| 1206 | } |
| 1207 | if doc.DurationField != 120*timescip-go gomod github.com/golang/go/src go1.21.0 time/.Millisecondscip-go gomod github.com/golang/go/src go1.21.0 time/Millisecond. { |
| 1208 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("DurationField should be 120ms, not %s", doc.DurationField.Stringscip-go gomod github.com/golang/go/src go1.21.0 time/Duration#String().()) |
| 1209 | } |
| 1210 | if doc.DurationField2 != 120*timescip-go gomod github.com/golang/go/src go1.21.0 time/.Millisecondscip-go gomod github.com/golang/go/src go1.21.0 time/Millisecond. { |
| 1211 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("DurationField2 should be 120000000, not %d", doc.DurationField2) |
| 1212 | } |
| 1213 | if doc.NonEmbeddedStruct.StringField != "b" { |
| 1214 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("StringField should be \"b\", not %s", doc.NonEmbeddedStruct.StringField) |
| 1215 | } |
| 1216 | if doc.EmbeddedStruct.StringField != "c" { |
| 1217 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("StringField should be \"c\", not %s", doc.EmbeddedStruct.StringField) |
| 1218 | } |
| 1219 | if doc.AliasUintField != 1000 { |
| 1220 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("AliasUintField should be 1000, not %d", doc.AliasUintField) |
| 1221 | } |
| 1222 | }) |
| 1223 | |
| 1224 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("failure bool", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1225 | var doc struct { |
| 1226 | Field bool `default:"blah"` |
| 1227 | } |
| 1228 | |
| 1229 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(``), &doc) |
| 1230 | if err == nil { |
| 1231 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("should error") |
| 1232 | } |
| 1233 | }) |
| 1234 | |
| 1235 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("failure int", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1236 | var doc struct { |
| 1237 | Field int `default:"blah"` |
| 1238 | } |
| 1239 | |
| 1240 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(``), &doc) |
| 1241 | if err == nil { |
| 1242 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("should error") |
| 1243 | } |
| 1244 | }) |
| 1245 | |
| 1246 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("failure int64", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1247 | var doc struct { |
| 1248 | Field int64 `default:"blah"` |
| 1249 | } |
| 1250 | |
| 1251 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(``), &doc) |
| 1252 | if err == nil { |
| 1253 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("should error") |
| 1254 | } |
| 1255 | }) |
| 1256 | |
| 1257 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("failure float64", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1258 | var doc struct { |
| 1259 | Field float64 `default:"blah"` |
| 1260 | } |
| 1261 | |
| 1262 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(``), &doc) |
| 1263 | if err == nil { |
| 1264 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("should error") |
| 1265 | } |
| 1266 | }) |
| 1267 | |
| 1268 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("failure duration", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1269 | var doc struct { |
| 1270 | Field timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/golang/go/src go1.21.0 time/Duration# `default:"blah"` |
| 1271 | } |
| 1272 | |
| 1273 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(``), &doc) |
| 1274 | if err == nil { |
| 1275 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("should error") |
| 1276 | } |
| 1277 | }) |
| 1278 | |
| 1279 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("failure unsupported", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1280 | var doc struct { |
| 1281 | Field struct{} `default:"blah"` |
| 1282 | } |
| 1283 | |
| 1284 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(``), &doc) |
| 1285 | if err == nil { |
| 1286 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("should error") |
| 1287 | } |
| 1288 | }) |
| 1289 | } |
| 1290 | |
| 1291 | func TestUnmarshalNestedAnonymousStructsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalNestedAnonymousStructs().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1292 | type Nested struct { |
| 1293 | Value string `toml:"nested_field"` |
| 1294 | } |
| 1295 | type Deep struct { |
| 1296 | Nested |
| 1297 | } |
| 1298 | type Document struct { |
| 1299 | Deep |
| 1300 | Value string `toml:"own_field"` |
| 1301 | } |
| 1302 | |
| 1303 | var doc Document |
| 1304 | |
| 1305 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(`nested_field = "nested value"`+"\n"+`own_field = "own value"`), &doc) |
| 1306 | if err != nil { |
| 1307 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("should not error") |
| 1308 | } |
| 1309 | if doc.Value != "own value" || doc.Nested.Value != "nested value" { |
| 1310 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("unexpected values") |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | func TestUnmarshalNestedAnonymousStructs_Controversialscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalNestedAnonymousStructs_Controversial().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1315 | t.Skipfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Skipf().("TODO: what does encoding/json do?") |
| 1316 | type Nested struct { |
| 1317 | Value string `toml:"nested"` |
| 1318 | } |
| 1319 | type Deep struct { |
| 1320 | Nested |
| 1321 | } |
| 1322 | type Document struct { |
| 1323 | Deep |
| 1324 | Value string `toml:"own"` |
| 1325 | } |
| 1326 | |
| 1327 | var doc Document |
| 1328 | |
| 1329 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(`nested = "nested value"`+"\n"+`own = "own value"`), &doc) |
| 1330 | if err == nil { |
| 1331 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("should error") |
| 1332 | } |
| 1333 | } |
| 1334 | |
| 1335 | type unexportedFieldPreservationTestscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest# struct { |
| 1336 | Exportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Exported. string `toml:"exported"` |
| 1337 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#unexported. string |
| 1338 | Nested1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested1. unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested# `toml:"nested1"` |
| 1339 | Nested2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested2. *unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested# `toml:"nested2"` |
| 1340 | Nested3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested3. *unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested# `toml:"nested3"` |
| 1341 | Slice1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Slice1. []unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested# `toml:"slice1"` |
| 1342 | Slice2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Slice2. []*unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested# `toml:"slice2"` |
| 1343 | } |
| 1344 | |
| 1345 | type unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested# struct { |
| 1346 | Exported1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#Exported1. string `toml:"exported1"` |
| 1347 | unexported1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#unexported1. string |
| 1348 | } |
| 1349 | |
| 1350 | func TestUnmarshalPreservesUnexportedFieldsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalPreservesUnexportedFields().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1351 | doc := ` |
| 1352 | exported = "visible" |
| 1353 | unexported = "ignored" |
| 1354 | |
| 1355 | [nested1] |
| 1356 | exported1 = "visible1" |
| 1357 | unexported1 = "ignored1" |
| 1358 | |
| 1359 | [nested2] |
| 1360 | exported1 = "visible2" |
| 1361 | unexported1 = "ignored2" |
| 1362 | |
| 1363 | [nested3] |
| 1364 | exported1 = "visible3" |
| 1365 | unexported1 = "ignored3" |
| 1366 | |
| 1367 | [[slice1]] |
| 1368 | exported1 = "visible3" |
| 1369 | |
| 1370 | [[slice1]] |
| 1371 | exported1 = "visible4" |
| 1372 | |
| 1373 | [[slice2]] |
| 1374 | exported1 = "visible5" |
| 1375 | ` |
| 1376 | |
| 1377 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("unexported field should not be set from toml", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1378 | var actual unexportedFieldPreservationTestscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest# |
| 1379 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &actual) |
| 1380 | if err != nil { |
| 1381 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("did not expect an error") |
| 1382 | } |
| 1383 | |
| 1384 | expect := unexportedFieldPreservationTestscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#{ |
| 1385 | Exportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Exported.: "visible", |
| 1386 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#unexported.: "", |
| 1387 | Nested1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested1.: unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{"visible1", ""}, |
| 1388 | Nested2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested2.: &unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{"visible2", ""}, |
| 1389 | Nested3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested3.: &unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{"visible3", ""}, |
| 1390 | Slice1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Slice1.: []unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{ |
| 1391 | {Exported1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#Exported1.: "visible3"}, |
| 1392 | {Exported1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#Exported1.: "visible4"}, |
| 1393 | }, |
| 1394 | Slice2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Slice2.: []*unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{ |
| 1395 | {Exported1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#Exported1.: "visible5"}, |
| 1396 | }, |
| 1397 | } |
| 1398 | |
| 1399 | if !reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21.0 reflect/DeepEqual().(actual, expect) { |
| 1400 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("%+v did not equal %+v", actual, expect) |
| 1401 | } |
| 1402 | }) |
| 1403 | |
| 1404 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("unexported field should be preserved", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1405 | actual := unexportedFieldPreservationTestscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#{ |
| 1406 | Exportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Exported.: "foo", |
| 1407 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#unexported.: "bar", |
| 1408 | Nested1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested1.: unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{"baz", "bax"}, |
| 1409 | Nested2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested2.: nil, |
| 1410 | Nested3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested3.: &unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{"baz", "bax"}, |
| 1411 | } |
| 1412 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &actual) |
| 1413 | if err != nil { |
| 1414 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().("did not expect an error") |
| 1415 | } |
| 1416 | |
| 1417 | expect := unexportedFieldPreservationTestscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#{ |
| 1418 | Exportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Exported.: "visible", |
| 1419 | unexportedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#unexported.: "bar", |
| 1420 | Nested1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested1.: unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{"visible1", "bax"}, |
| 1421 | Nested2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested2.: &unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{"visible2", ""}, |
| 1422 | Nested3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Nested3.: &unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{"visible3", "bax"}, |
| 1423 | Slice1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Slice1.: []unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{ |
| 1424 | {Exported1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#Exported1.: "visible3"}, |
| 1425 | {Exported1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#Exported1.: "visible4"}, |
| 1426 | }, |
| 1427 | Slice2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTest#Slice2.: []*unexportedFieldPreservationTestNestedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#{ |
| 1428 | {Exported1scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/unexportedFieldPreservationTestNested#Exported1.: "visible5"}, |
| 1429 | }, |
| 1430 | } |
| 1431 | |
| 1432 | if !reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21.0 reflect/DeepEqual().(actual, expect) { |
| 1433 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("%+v did not equal %+v", actual, expect) |
| 1434 | } |
| 1435 | }) |
| 1436 | } |
| 1437 | |
| 1438 | func TestUnmarshalLocalDatescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalLocalDate().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1439 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("ToLocalDate", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1440 | type dateStruct struct { |
| 1441 | Date tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalDatescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate# |
| 1442 | } |
| 1443 | |
| 1444 | doc := `date = 1979-05-27` |
| 1445 | |
| 1446 | var obj dateStruct |
| 1447 | |
| 1448 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &obj) |
| 1449 | if err != nil { |
| 1450 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 1451 | } |
| 1452 | |
| 1453 | if obj.Date.Yearscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Year. != 1979 { |
| 1454 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected year 1979, got %d", obj.Date.Yearscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Year.) |
| 1455 | } |
| 1456 | if obj.Date.Monthscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Month. != 5 { |
| 1457 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected month 5, got %d", obj.Date.Monthscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Month.) |
| 1458 | } |
| 1459 | if obj.Date.Dayscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Day. != 27 { |
| 1460 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected day 27, got %d", obj.Date.Dayscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Day.) |
| 1461 | } |
| 1462 | }) |
| 1463 | |
| 1464 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("ToLocalDate", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1465 | type dateStruct struct { |
| 1466 | Date timescip-go gomod github.com/golang/go/src go1.21.0 time/.Timescip-go gomod github.com/golang/go/src go1.21.0 time/Time# |
| 1467 | } |
| 1468 | |
| 1469 | doc := `date = 1979-05-27` |
| 1470 | |
| 1471 | var obj dateStruct |
| 1472 | |
| 1473 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &obj) |
| 1474 | if err != nil { |
| 1475 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 1476 | } |
| 1477 | |
| 1478 | if obj.Date.Yearscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Year().() != 1979 { |
| 1479 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected year 1979, got %d", obj.Date.Yearscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Year().()) |
| 1480 | } |
| 1481 | if obj.Date.Monthscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Month().() != 5 { |
| 1482 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected month 5, got %d", obj.Date.Monthscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Month().()) |
| 1483 | } |
| 1484 | if obj.Date.Dayscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Day().() != 27 { |
| 1485 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected day 27, got %d", obj.Date.Dayscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Day().()) |
| 1486 | } |
| 1487 | }) |
| 1488 | } |
| 1489 | |
| 1490 | func TestUnmarshalLocalDateTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalLocalDateTime().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1491 | examples := []struct { |
| 1492 | name string |
| 1493 | in string |
| 1494 | out tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalDateTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDateTime# |
| 1495 | }{ |
| 1496 | { |
| 1497 | name: "normal", |
| 1498 | in: "1979-05-27T07:32:00", |
| 1499 | out: tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalDateTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDateTime#{ |
| 1500 | LocalDatescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDateTime#LocalDate.: tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalDatescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#{ |
| 1501 | Yearscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Year.: 1979, |
| 1502 | Monthscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Month.: 5, |
| 1503 | Dayscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Day.: 27, |
| 1504 | }, |
| 1505 | LocalTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDateTime#LocalTime.: tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#{ |
| 1506 | Hourscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Hour.: 7, |
| 1507 | Minutescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Minute.: 32, |
| 1508 | Secondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Second.: 0, |
| 1509 | Nanosecondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Nanosecond.: 0, |
| 1510 | }, |
| 1511 | }, |
| 1512 | }, |
| 1513 | { |
| 1514 | name: "with nanoseconds", |
| 1515 | in: "1979-05-27T00:32:00.999999", |
| 1516 | out: tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalDateTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDateTime#{ |
| 1517 | LocalDatescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDateTime#LocalDate.: tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalDatescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#{ |
| 1518 | Yearscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Year.: 1979, |
| 1519 | Monthscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Month.: 5, |
| 1520 | Dayscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Day.: 27, |
| 1521 | }, |
| 1522 | LocalTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDateTime#LocalTime.: tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#{ |
| 1523 | Hourscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Hour.: 0, |
| 1524 | Minutescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Minute.: 32, |
| 1525 | Secondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Second.: 0, |
| 1526 | Nanosecondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Nanosecond.: 999999000, |
| 1527 | Precisionscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Precision.: 6, |
| 1528 | }, |
| 1529 | }, |
| 1530 | }, |
| 1531 | } |
| 1532 | |
| 1533 | for i, example := range examples { |
| 1534 | doc := "date = " + example.in |
| 1535 | |
| 1536 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().("ToLocalDateTime_%d_%s", i, example.name), func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1537 | type dateStruct struct { |
| 1538 | Date tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalDateTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDateTime# |
| 1539 | } |
| 1540 | |
| 1541 | var obj dateStruct |
| 1542 | |
| 1543 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &obj) |
| 1544 | if err != nil { |
| 1545 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 1546 | } |
| 1547 | |
| 1548 | if obj.Date != example.out { |
| 1549 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected '%s', got '%s'", example.out, obj.Date) |
| 1550 | } |
| 1551 | }) |
| 1552 | |
| 1553 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().("ToTime_%d_%s", i, example.name), func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1554 | type dateStruct struct { |
| 1555 | Date timescip-go gomod github.com/golang/go/src go1.21.0 time/.Timescip-go gomod github.com/golang/go/src go1.21.0 time/Time# |
| 1556 | } |
| 1557 | |
| 1558 | var obj dateStruct |
| 1559 | |
| 1560 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &obj) |
| 1561 | if err != nil { |
| 1562 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 1563 | } |
| 1564 | |
| 1565 | if obj.Date.Yearscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Year().() != example.out.Yearscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Year. { |
| 1566 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected year %d, got %d", example.out.Yearscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Year., obj.Date.Yearscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Year().()) |
| 1567 | } |
| 1568 | if obj.Date.Monthscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Month().() != timescip-go gomod github.com/golang/go/src go1.21.0 time/.Monthscip-go gomod github.com/golang/go/src go1.21.0 time/Month#(example.out.Monthscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Month.) { |
| 1569 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected month %d, got %d", example.out.Monthscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Month., obj.Date.Monthscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Month().()) |
| 1570 | } |
| 1571 | if obj.Date.Dayscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Day().() != example.out.Dayscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Day. { |
| 1572 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected day %d, got %d", example.out.Dayscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalDate#Day., obj.Date.Dayscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Day().()) |
| 1573 | } |
| 1574 | if obj.Date.Hourscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Hour().() != example.out.Hourscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Hour. { |
| 1575 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected hour %d, got %d", example.out.Hourscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Hour., obj.Date.Hourscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Hour().()) |
| 1576 | } |
| 1577 | if obj.Date.Minutescip-go gomod github.com/golang/go/src go1.21.0 time/Time#Minute().() != example.out.Minutescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Minute. { |
| 1578 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected minute %d, got %d", example.out.Minutescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Minute., obj.Date.Minutescip-go gomod github.com/golang/go/src go1.21.0 time/Time#Minute().()) |
| 1579 | } |
| 1580 | if obj.Date.Secondscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Second().() != example.out.Secondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Second. { |
| 1581 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected second %d, got %d", example.out.Secondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Second., obj.Date.Secondscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Second().()) |
| 1582 | } |
| 1583 | if obj.Date.Nanosecondscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Nanosecond().() != example.out.Nanosecondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Nanosecond. { |
| 1584 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected nanoseconds %d, got %d", example.out.Nanosecondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Nanosecond., obj.Date.Nanosecondscip-go gomod github.com/golang/go/src go1.21.0 time/Time#Nanosecond().()) |
| 1585 | } |
| 1586 | }) |
| 1587 | } |
| 1588 | } |
| 1589 | |
| 1590 | func TestUnmarshalLocalTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalLocalTime().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1591 | examples := []struct { |
| 1592 | name string |
| 1593 | in string |
| 1594 | out tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime# |
| 1595 | }{ |
| 1596 | { |
| 1597 | name: "normal", |
| 1598 | in: "07:32:00", |
| 1599 | out: tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#{ |
| 1600 | Hourscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Hour.: 7, |
| 1601 | Minutescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Minute.: 32, |
| 1602 | Secondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Second.: 0, |
| 1603 | Nanosecondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Nanosecond.: 0, |
| 1604 | }, |
| 1605 | }, |
| 1606 | { |
| 1607 | name: "with nanoseconds", |
| 1608 | in: "00:32:00.999999", |
| 1609 | out: tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#{ |
| 1610 | Hourscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Hour.: 0, |
| 1611 | Minutescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Minute.: 32, |
| 1612 | Secondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Second.: 0, |
| 1613 | Nanosecondscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Nanosecond.: 999999000, |
| 1614 | Precisionscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime#Precision.: 6, |
| 1615 | }, |
| 1616 | }, |
| 1617 | } |
| 1618 | |
| 1619 | for i, example := range examples { |
| 1620 | doc := "Time = " + example.in |
| 1621 | |
| 1622 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().("ToLocalTime_%d_%s", i, example.name), func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1623 | type dateStruct struct { |
| 1624 | Time tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.LocalTimescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/LocalTime# |
| 1625 | } |
| 1626 | |
| 1627 | var obj dateStruct |
| 1628 | |
| 1629 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &obj) |
| 1630 | if err != nil { |
| 1631 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 1632 | } |
| 1633 | |
| 1634 | if obj.Time != example.out { |
| 1635 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected '%s', got '%s'", example.out, obj.Time) |
| 1636 | } |
| 1637 | }) |
| 1638 | } |
| 1639 | } |
| 1640 | |
| 1641 | // test case for issue #339 |
| 1642 | func TestUnmarshalSameInnerFieldscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalSameInnerField().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1643 | type InterStruct2 struct { |
| 1644 | Test string |
| 1645 | Name string |
| 1646 | Age int |
| 1647 | } |
| 1648 | type Inter2 struct { |
| 1649 | Name string |
| 1650 | Age int |
| 1651 | InterStruct2 InterStruct2 |
| 1652 | } |
| 1653 | type Server struct { |
| 1654 | Name string `toml:"name"` |
| 1655 | Inter2 Inter2 `toml:"inter2"` |
| 1656 | } |
| 1657 | |
| 1658 | var server Server |
| 1659 | |
| 1660 | if err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(`name = "123" |
| 1661 | [inter2] |
| 1662 | name = "inter2" |
| 1663 | age = 222`), &server); err == nil { |
| 1664 | expected := Server{ |
| 1665 | Name: "123", |
| 1666 | Inter2: Inter2{ |
| 1667 | Name: "inter2", |
| 1668 | Age: 222, |
| 1669 | }, |
| 1670 | } |
| 1671 | if !reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21.0 reflect/DeepEqual().(server, expected) { |
| 1672 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Bad unmarshal: expected %v, got %v", expected, server) |
| 1673 | } |
| 1674 | } else { |
| 1675 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("unexpected error: %v", err) |
| 1676 | } |
| 1677 | } |
| 1678 | |
| 1679 | func TestUnmarshalToNilInterfacescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalToNilInterface().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1680 | doc := []byte(` |
| 1681 | PrimitiveField = "Hello" |
| 1682 | ArrayField = [1,2,3] |
| 1683 | InterfacePointerField = "World" |
| 1684 | |
| 1685 | [StructField] |
| 1686 | Field1 = 123 |
| 1687 | Field2 = "Field2" |
| 1688 | |
| 1689 | [MapField] |
| 1690 | MapField1 = [4,5,6] |
| 1691 | MapField2 = {A = "A"} |
| 1692 | MapField3 = false |
| 1693 | |
| 1694 | [[StructArrayField]] |
| 1695 | Name = "Allen" |
| 1696 | Age = 20 |
| 1697 | |
| 1698 | [[StructArrayField]] |
| 1699 | Name = "Jack" |
| 1700 | Age = 23 |
| 1701 | `) |
| 1702 | |
| 1703 | type OuterStruct struct { |
| 1704 | PrimitiveField interface{} |
| 1705 | ArrayField interface{} |
| 1706 | StructArrayField interface{} |
| 1707 | MapField map[string]interface{} |
| 1708 | StructField interface{} |
| 1709 | NilField interface{} |
| 1710 | InterfacePointerField *interface{} |
| 1711 | } |
| 1712 | |
| 1713 | var s interface{} = "World" |
| 1714 | expected := OuterStruct{ |
| 1715 | PrimitiveField: "Hello", |
| 1716 | ArrayField: []interface{}{int64(1), int64(2), int64(3)}, |
| 1717 | StructField: map[string]interface{}{ |
| 1718 | "Field1": int64(123), |
| 1719 | "Field2": "Field2", |
| 1720 | }, |
| 1721 | MapField: map[string]interface{}{ |
| 1722 | "MapField1": []interface{}{int64(4), int64(5), int64(6)}, |
| 1723 | "MapField2": map[string]interface{}{ |
| 1724 | "A": "A", |
| 1725 | }, |
| 1726 | "MapField3": false, |
| 1727 | }, |
| 1728 | NilField: nil, |
| 1729 | InterfacePointerField: &s, |
| 1730 | StructArrayField: []interface{}{ |
| 1731 | map[string]interface{}{ |
| 1732 | "Name": "Allen", |
| 1733 | "Age": int64(20), |
| 1734 | }, |
| 1735 | map[string]interface{}{ |
| 1736 | "Name": "Jack", |
| 1737 | "Age": int64(23), |
| 1738 | }, |
| 1739 | }, |
| 1740 | } |
| 1741 | actual := OuterStruct{} |
| 1742 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(doc, &actual) |
| 1743 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 1744 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, expected, actual) |
| 1745 | } |
| 1746 | |
| 1747 | func TestUnmarshalToNonNilInterfacescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalToNonNilInterface().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1748 | doc := []byte(` |
| 1749 | PrimitiveField = "Allen" |
| 1750 | ArrayField = [1,2,3] |
| 1751 | |
| 1752 | [StructField] |
| 1753 | InnerField = "After1" |
| 1754 | |
| 1755 | [PointerField] |
| 1756 | InnerField = "After2" |
| 1757 | |
| 1758 | [InterfacePointerField] |
| 1759 | InnerField = "After" |
| 1760 | |
| 1761 | [MapField] |
| 1762 | MapField1 = [4,5,6] |
| 1763 | MapField2 = {A = "A"} |
| 1764 | MapField3 = false |
| 1765 | |
| 1766 | [[StructArrayField]] |
| 1767 | InnerField = "After3" |
| 1768 | |
| 1769 | [[StructArrayField]] |
| 1770 | InnerField = "After4" |
| 1771 | `) |
| 1772 | type InnerStruct struct { |
| 1773 | InnerField interface{} |
| 1774 | } |
| 1775 | |
| 1776 | type OuterStruct struct { |
| 1777 | PrimitiveField interface{} |
| 1778 | ArrayField interface{} |
| 1779 | StructArrayField interface{} |
| 1780 | MapField map[string]interface{} |
| 1781 | StructField interface{} |
| 1782 | PointerField interface{} |
| 1783 | NilField interface{} |
| 1784 | InterfacePointerField *interface{} |
| 1785 | } |
| 1786 | |
| 1787 | var s interface{} = InnerStruct{"After"} |
| 1788 | expected := OuterStruct{ |
| 1789 | PrimitiveField: "Allen", |
| 1790 | ArrayField: []interface{}{int64(1), int64(2), int64(3)}, |
| 1791 | StructField: map[string]interface{}{"InnerField": "After1"}, |
| 1792 | MapField: map[string]interface{}{ |
| 1793 | "MapField1": []interface{}{int64(4), int64(5), int64(6)}, |
| 1794 | "MapField2": map[string]interface{}{ |
| 1795 | "A": "A", |
| 1796 | }, |
| 1797 | "MapField3": false, |
| 1798 | }, |
| 1799 | PointerField: map[string]interface{}{"InnerField": "After2"}, |
| 1800 | NilField: nil, |
| 1801 | InterfacePointerField: &s, |
| 1802 | StructArrayField: []interface{}{ |
| 1803 | map[string]interface{}{"InnerField": "After3"}, |
| 1804 | map[string]interface{}{"InnerField": "After4"}, |
| 1805 | }, |
| 1806 | } |
| 1807 | actual := OuterStruct{ |
| 1808 | PrimitiveField: "aaa", |
| 1809 | ArrayField: []int{100, 200, 300, 400}, |
| 1810 | StructField: InnerStruct{InnerField: "Before1"}, |
| 1811 | MapField: map[string]interface{}{ |
| 1812 | "MapField1": []int{4, 5, 6}, |
| 1813 | "MapField2": map[string]string{ |
| 1814 | "B": "BBB", |
| 1815 | }, |
| 1816 | "MapField3": true, |
| 1817 | }, |
| 1818 | PointerField: &InnerStruct{InnerField: "Before2"}, |
| 1819 | NilField: nil, |
| 1820 | InterfacePointerField: &s, |
| 1821 | StructArrayField: []InnerStruct{ |
| 1822 | {InnerField: "Before3"}, |
| 1823 | {InnerField: "Before4"}, |
| 1824 | }, |
| 1825 | } |
| 1826 | |
| 1827 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(doc, &actual) |
| 1828 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 1829 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, expected, actual) |
| 1830 | } |
| 1831 | |
| 1832 | func TestUnmarshalNilscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalNil().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1833 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(`whatever = "whatever"`), nil)) |
| 1834 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(`whatever = "whatever"`), (*struct{})(nil))) |
| 1835 | } |
| 1836 | |
| 1837 | var sliceTomlDemoscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceTomlDemo. = []byte(`str_slice = ["Howdy","Hey There"] |
| 1838 | str_slice_ptr= ["Howdy","Hey There"] |
| 1839 | int_slice=[1,2] |
| 1840 | int_slice_ptr=[1,2] |
| 1841 | [[struct_slice]] |
| 1842 | String2="1" |
| 1843 | [[struct_slice]] |
| 1844 | String2="2" |
| 1845 | [[struct_slice_ptr]] |
| 1846 | String2="1" |
| 1847 | [[struct_slice_ptr]] |
| 1848 | String2="2" |
| 1849 | `) |
| 1850 | |
| 1851 | type sliceStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct# struct { |
| 1852 | Slicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#Slice. []string ` toml:"str_slice" ` |
| 1853 | SlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#SlicePtr. *[]string ` toml:"str_slice_ptr" ` |
| 1854 | IntSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#IntSlice. []int ` toml:"int_slice" ` |
| 1855 | IntSlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#IntSlicePtr. *[]int ` toml:"int_slice_ptr" ` |
| 1856 | StructSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#StructSlice. []basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# ` toml:"struct_slice" ` |
| 1857 | StructSlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#StructSlicePtr. *[]basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# ` toml:"struct_slice_ptr" ` |
| 1858 | } |
| 1859 | |
| 1860 | type arrayStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct# struct { |
| 1861 | Slicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#Slice. [4]string ` toml:"str_slice" ` |
| 1862 | SlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#SlicePtr. *[4]string ` toml:"str_slice_ptr" ` |
| 1863 | IntSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#IntSlice. [4]int ` toml:"int_slice" ` |
| 1864 | IntSlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#IntSlicePtr. *[4]int ` toml:"int_slice_ptr" ` |
| 1865 | StructSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#StructSlice. [4]basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# ` toml:"struct_slice" ` |
| 1866 | StructSlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#StructSlicePtr. *[4]basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# ` toml:"struct_slice_ptr" ` |
| 1867 | } |
| 1868 | |
| 1869 | type arrayTooSmallStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayTooSmallStruct# struct { |
| 1870 | Slicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayTooSmallStruct#Slice. [1]string ` toml:"str_slice" ` |
| 1871 | StructSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayTooSmallStruct#StructSlice. [1]basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct# ` toml:"struct_slice" ` |
| 1872 | } |
| 1873 | |
| 1874 | func TestUnmarshalSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalSlice().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1875 | var actual sliceStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct# |
| 1876 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(sliceTomlDemoscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceTomlDemo., &actual) |
| 1877 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 1878 | expected := sliceStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#{ |
| 1879 | Slicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#Slice.: []string{"Howdy", "Hey There"}, |
| 1880 | SlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#SlicePtr.: &[]string{"Howdy", "Hey There"}, |
| 1881 | IntSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#IntSlice.: []int{1, 2}, |
| 1882 | IntSlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#IntSlicePtr.: &[]int{1, 2}, |
| 1883 | StructSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#StructSlice.: []basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{{"1"}, {"2"}}, |
| 1884 | StructSlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct#StructSlicePtr.: &[]basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{{"1"}, {"2"}}, |
| 1885 | } |
| 1886 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, expected, actual) |
| 1887 | } |
| 1888 | |
| 1889 | func TestUnmarshalSliceFailscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalSliceFail().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1890 | var actual sliceStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct# |
| 1891 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(`str_slice = [1, 2]`), &actual)) |
| 1892 | } |
| 1893 | |
| 1894 | func TestUnmarshalSliceFail2scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalSliceFail2().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1895 | doc := `str_slice=[1,2]` |
| 1896 | var actual sliceStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceStruct# |
| 1897 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &actual)) |
| 1898 | } |
| 1899 | |
| 1900 | func TestUnmarshalMixedTypeSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalMixedTypeSlice().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1901 | type TestStruct struct { |
| 1902 | ArrayField []interface{} |
| 1903 | } |
| 1904 | |
| 1905 | doc := []byte(`ArrayField = [{Field = "inner1"},[{Field = "inner2"},{Field = "inner3"}]] |
| 1906 | `) |
| 1907 | |
| 1908 | actual := TestStruct{} |
| 1909 | expected := TestStruct{ |
| 1910 | ArrayField: []interface{}{ |
| 1911 | map[string]interface{}{ |
| 1912 | "Field": "inner1", |
| 1913 | }, |
| 1914 | []interface{}{ |
| 1915 | map[string]interface{}{"Field": "inner2"}, |
| 1916 | map[string]interface{}{"Field": "inner3"}, |
| 1917 | }, |
| 1918 | }, |
| 1919 | } |
| 1920 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(doc, &actual) |
| 1921 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 1922 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, expected, actual) |
| 1923 | } |
| 1924 | |
| 1925 | func TestUnmarshalArrayscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalArray().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1926 | var err error |
| 1927 | |
| 1928 | var actual arrayStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct# |
| 1929 | err = tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(sliceTomlDemoscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/sliceTomlDemo., &actual) |
| 1930 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 1931 | |
| 1932 | expected := arrayStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#{ |
| 1933 | Slicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#Slice.: [4]string{"Howdy", "Hey There"}, |
| 1934 | SlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#SlicePtr.: &[4]string{"Howdy", "Hey There"}, |
| 1935 | IntSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#IntSlice.: [4]int{1, 2}, |
| 1936 | IntSlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#IntSlicePtr.: &[4]int{1, 2}, |
| 1937 | StructSlicescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#StructSlice.: [4]basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{{"1"}, {"2"}}, |
| 1938 | StructSlicePtrscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayStruct#StructSlicePtr.: &[4]basicMarshalTestSubStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/basicMarshalTestSubStruct#{{"1"}, {"2"}}, |
| 1939 | } |
| 1940 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, expected, actual) |
| 1941 | } |
| 1942 | |
| 1943 | func TestUnmarshalArrayFail3scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalArrayFail3().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1944 | doc := `[[struct_slice]] |
| 1945 | String2="1" |
| 1946 | [[struct_slice]] |
| 1947 | String2="2"` |
| 1948 | |
| 1949 | var actual arrayTooSmallStructscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/arrayTooSmallStruct# |
| 1950 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &actual) |
| 1951 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, err) |
| 1952 | } |
| 1953 | |
| 1954 | func decoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/decoder().(doc string) *tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Decoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Decoder# { |
| 1955 | return tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.NewDecoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/NewDecoder().(bytesscip-go gomod github.com/golang/go/src go1.21.0 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.21.0 bytes/NewReader().([]byte(doc))) |
| 1956 | } |
| 1957 | |
| 1958 | func strictDecoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/strictDecoder().(doc string) *tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Decoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Decoder# { |
| 1959 | d := decoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/decoder().(doc) |
| 1960 | d.DisallowUnknownFieldsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Decoder#DisallowUnknownFields().() |
| 1961 | return d |
| 1962 | } |
| 1963 | |
| 1964 | func TestDecoderStrictscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestDecoderStrict().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 1965 | input := ` |
| 1966 | [decoded] |
| 1967 | key = "" |
| 1968 | |
| 1969 | [undecoded] |
| 1970 | key = "" |
| 1971 | |
| 1972 | [undecoded.inner] |
| 1973 | key = "" |
| 1974 | |
| 1975 | [[undecoded.array]] |
| 1976 | key = "" |
| 1977 | |
| 1978 | [[undecoded.array]] |
| 1979 | key = "" |
| 1980 | |
| 1981 | ` |
| 1982 | var doc struct { |
| 1983 | Decoded struct { |
| 1984 | Key string |
| 1985 | } |
| 1986 | } |
| 1987 | |
| 1988 | err := strictDecoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/strictDecoder().(input).Decodescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Decoder#Decode().(&doc) |
| 1989 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Error().(t, err) |
| 1990 | |
| 1991 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, |
| 1992 | reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.21.0 reflect/TypeOf().(err), reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.21.0 reflect/TypeOf().(&tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.StrictMissingErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/StrictMissingError#{}), |
| 1993 | "Expected a *toml.StrictMissingError, got: %v", reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.21.0 reflect/TypeOf().(err), |
| 1994 | ) |
| 1995 | |
| 1996 | var se *tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.StrictMissingErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/StrictMissingError# |
| 1997 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Truescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/True().(t, errorsscip-go gomod github.com/golang/go/src go1.21.0 errors/.Asscip-go gomod github.com/golang/go/src go1.21.0 errors/As().(err, &se)) |
| 1998 | |
| 1999 | keys := make([]tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Key#, 0, len(se.Errorsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/StrictMissingError#Errors.)) |
| 2000 | |
| 2001 | for _, e := range se.Errorsscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/StrictMissingError#Errors. { |
| 2002 | keys = append(keys, e.Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/DecodeError#Key().()) |
| 2003 | } |
| 2004 | |
| 2005 | expectedKeys := []tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Key#{ |
| 2006 | {"undecoded"}, |
| 2007 | {"undecoded", "inner"}, |
| 2008 | {"undecoded", "array"}, |
| 2009 | {"undecoded", "array"}, |
| 2010 | } |
| 2011 | |
| 2012 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, expectedKeys, keys) |
| 2013 | |
| 2014 | err = decoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/decoder().(input).Decodescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Decoder#Decode().(&doc) |
| 2015 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 2016 | |
| 2017 | var m map[string]interface{} |
| 2018 | err = decoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/decoder().(input).Decodescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Decoder#Decode().(&m) |
| 2019 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 2020 | } |
| 2021 | |
| 2022 | func TestDecoderStrictValidscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestDecoderStrictValid().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2023 | input := ` |
| 2024 | [decoded] |
| 2025 | key = "" |
| 2026 | ` |
| 2027 | var doc struct { |
| 2028 | Decoded struct { |
| 2029 | Key string |
| 2030 | } |
| 2031 | } |
| 2032 | |
| 2033 | err := strictDecoderscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/strictDecoder().(input).Decodescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Decoder#Decode().(&doc) |
| 2034 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 2035 | } |
| 2036 | |
| 2037 | type docUnmarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML# struct { |
| 2038 | Decodedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#Decoded. struct { |
| 2039 | Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#$anon_3a2851719794797b#Key. string |
| 2040 | } |
| 2041 | } |
| 2042 | |
| 2043 | func (d *docUnmarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#) UnmarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#UnmarshalTOML().(i interface{}) error { |
| 2044 | if iMap, ok := i.(map[string]interface{}); !ok { |
| 2045 | return fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Errorf().("type assertion error: wants %T, have %T", map[string]interface{}{}, i) |
| 2046 | } else if key, ok := iMap["key"]; !ok { |
| 2047 | return fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Errorf().("key '%s' not in map", "key") |
| 2048 | } else if keyString, ok := key.(string); !ok { |
| 2049 | return fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Errorf().("type assertion error: wants %T, have %T", "", key) |
| 2050 | } else { |
| 2051 | d.Decodedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#Decoded..Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#$anon_3a2851719794797b#Key. = keyString |
| 2052 | } |
| 2053 | return nil |
| 2054 | } |
| 2055 | |
| 2056 | type parentscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/parent# struct { |
| 2057 | Docscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/parent#Doc. docUnmarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML# |
| 2058 | DocPointerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/parent#DocPointer. *docUnmarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML# |
| 2059 | } |
| 2060 | |
| 2061 | func TestCustomUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestCustomUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2062 | t.Skipscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Skip().("not sure if UnmarshalTOML is a good idea") |
| 2063 | input := ` |
| 2064 | [Doc] |
| 2065 | key = "ok1" |
| 2066 | [DocPointer] |
| 2067 | key = "ok2" |
| 2068 | ` |
| 2069 | |
| 2070 | var d parentscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/parent# |
| 2071 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(input), &d) |
| 2072 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 2073 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, "ok1", d.Docscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/parent#Doc..Decodedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#Decoded..Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#$anon_3a2851719794797b#Key.) |
| 2074 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, "ok2", d.DocPointerscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/parent#DocPointer..Decodedscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#Decoded..Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/docUnmarshalTOML#$anon_3a2851719794797b#Key.) |
| 2075 | } |
| 2076 | |
| 2077 | func TestCustomUnmarshalErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestCustomUnmarshalError().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2078 | t.Skipscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Skip().("not sure if UnmarshalTOML is a good idea") |
| 2079 | |
| 2080 | input := ` |
| 2081 | [Doc] |
| 2082 | key = 1 |
| 2083 | [DocPointer] |
| 2084 | key = "ok2" |
| 2085 | ` |
| 2086 | |
| 2087 | expected := "(2, 1): unmarshal toml: type assertion error: wants string, have int64" |
| 2088 | |
| 2089 | var d parentscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/parent# |
| 2090 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(input), &d) |
| 2091 | if err == nil { |
| 2092 | t.Errorscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Error().("expected error, got none") |
| 2093 | } else if err.Error() != expected { |
| 2094 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expect err: %s, got: %s", expected, err.Error()) |
| 2095 | } |
| 2096 | } |
| 2097 | |
| 2098 | type intWrapperscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper# struct { |
| 2099 | Valuescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#Value. int |
| 2100 | } |
| 2101 | |
| 2102 | func (w *intWrapperscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#) UnmarshalTextscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#UnmarshalText().(text []byte) error { |
| 2103 | var err error |
| 2104 | if w.Valuescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#Value., err = strconvscip-go gomod github.com/golang/go/src go1.21.0 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.21.0 strconv/Atoi().(string(text)); err == nil { |
| 2105 | return nil |
| 2106 | } |
| 2107 | if b, err := strconvscip-go gomod github.com/golang/go/src go1.21.0 strconv/.ParseBoolscip-go gomod github.com/golang/go/src go1.21.0 strconv/ParseBool().(string(text)); err == nil { |
| 2108 | if b { |
| 2109 | w.Valuescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#Value. = 1 |
| 2110 | } |
| 2111 | return nil |
| 2112 | } |
| 2113 | if f, err := strconvscip-go gomod github.com/golang/go/src go1.21.0 strconv/.ParseFloatscip-go gomod github.com/golang/go/src go1.21.0 strconv/ParseFloat().(string(text), 32); err == nil { |
| 2114 | w.Valuescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#Value. = int(f) |
| 2115 | return nil |
| 2116 | } |
| 2117 | return fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Errorf().("unsupported: %s", text) |
| 2118 | } |
| 2119 | |
| 2120 | func TestTextUnmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestTextUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2121 | var doc struct { |
| 2122 | UnixTime intWrapperscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper# |
| 2123 | Version *intWrapperscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper# |
| 2124 | |
| 2125 | Bool intWrapperscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper# |
| 2126 | Int intWrapperscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper# |
| 2127 | Float intWrapperscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper# |
| 2128 | } |
| 2129 | |
| 2130 | input := ` |
| 2131 | UnixTime = "12" |
| 2132 | Version = "42" |
| 2133 | Bool = true |
| 2134 | Int = 21 |
| 2135 | Float = 2.0 |
| 2136 | ` |
| 2137 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(input), &doc) |
| 2138 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.NoErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/NoError().(t, err) |
| 2139 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, 12, doc.UnixTime.Valuescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#Value.) |
| 2140 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, 42, doc.Version.Valuescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#Value.) |
| 2141 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, 1, doc.Bool.Valuescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#Value.) |
| 2142 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, 21, doc.Int.Valuescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#Value.) |
| 2143 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, 2, doc.Float.Valuescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper#Value.) |
| 2144 | } |
| 2145 | |
| 2146 | func TestTextUnmarshalErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestTextUnmarshalError().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2147 | var doc struct { |
| 2148 | Failer intWrapperscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/intWrapper# |
| 2149 | } |
| 2150 | |
| 2151 | input := `Failer = "hello"` |
| 2152 | if err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(input), &doc); err == nil { |
| 2153 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("expected err, got none") |
| 2154 | } |
| 2155 | } |
| 2156 | |
| 2157 | // issue406 |
| 2158 | func TestPreserveNotEmptyFieldscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestPreserveNotEmptyField().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2159 | doc := []byte(`Field1 = "ccc"`) |
| 2160 | type Inner struct { |
| 2161 | InnerField1 string |
| 2162 | InnerField2 int |
| 2163 | } |
| 2164 | type TestStruct struct { |
| 2165 | Field1 string |
| 2166 | Field2 int |
| 2167 | Field3 Inner |
| 2168 | } |
| 2169 | |
| 2170 | actual := TestStruct{ |
| 2171 | "aaa", |
| 2172 | 100, |
| 2173 | Inner{ |
| 2174 | "bbb", |
| 2175 | 200, |
| 2176 | }, |
| 2177 | } |
| 2178 | |
| 2179 | expected := TestStruct{ |
| 2180 | "ccc", |
| 2181 | 100, |
| 2182 | Inner{ |
| 2183 | "bbb", |
| 2184 | 200, |
| 2185 | }, |
| 2186 | } |
| 2187 | |
| 2188 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(doc, &actual) |
| 2189 | if err != nil { |
| 2190 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 2191 | } |
| 2192 | |
| 2193 | if !reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21.0 reflect/DeepEqual().(actual, expected) { |
| 2194 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("Bad unmarshal: expected %+v, got %+v", expected, actual) |
| 2195 | } |
| 2196 | } |
| 2197 | |
| 2198 | // github issue 432 |
| 2199 | func TestUnmarshalEmptyInterfacescip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalEmptyInterface().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2200 | doc := []byte(`User = "pelletier"`) |
| 2201 | |
| 2202 | var v interface{} |
| 2203 | |
| 2204 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(doc, &v) |
| 2205 | if err != nil { |
| 2206 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 2207 | } |
| 2208 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, |
| 2209 | reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.21.0 reflect/TypeOf().(map[string]interface{}{}), reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.21.0 reflect/TypeOf().(v), |
| 2210 | "Expected map[string]interface{}{} type, got: %v", reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.21.0 reflect/TypeOf().(v), |
| 2211 | ) |
| 2212 | |
| 2213 | x := v.(map[string]interface{}) |
| 2214 | assertscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/.Equalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/assert`/Equal().(t, "pelletier", x["User"]) |
| 2215 | } |
| 2216 | |
| 2217 | func TestUnmarshalEmptyInterfaceDeepscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestUnmarshalEmptyInterfaceDeep().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2218 | t.Skipfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Skipf().("TODO") |
| 2219 | doc := []byte(` |
| 2220 | User = "pelletier" |
| 2221 | Age = 99 |
| 2222 | |
| 2223 | [foo] |
| 2224 | bar = 42 |
| 2225 | `) |
| 2226 | |
| 2227 | var v interface{} |
| 2228 | |
| 2229 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().(doc, &v) |
| 2230 | if err != nil { |
| 2231 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 2232 | } |
| 2233 | |
| 2234 | x, ok := v.(map[string]interface{}) |
| 2235 | if !ok { |
| 2236 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatal().(err) |
| 2237 | } |
| 2238 | |
| 2239 | expected := map[string]interface{}{ |
| 2240 | "User": "pelletier", |
| 2241 | "Age": 99, |
| 2242 | "foo": map[string]interface{}{ |
| 2243 | "bar": 42, |
| 2244 | }, |
| 2245 | } |
| 2246 | |
| 2247 | reflectscip-go gomod github.com/golang/go/src go1.21.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21.0 reflect/DeepEqual().(x, expected) |
| 2248 | } |
| 2249 | |
| 2250 | type Configscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Config# struct { |
| 2251 | Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Config#Key. string `toml:"key"` |
| 2252 | Objscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Config#Obj. Customscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Custom# `toml:"obj"` |
| 2253 | } |
| 2254 | |
| 2255 | type Customscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Custom# struct { |
| 2256 | vscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Custom#v. string |
| 2257 | } |
| 2258 | |
| 2259 | func (c *Customscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Custom#) UnmarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Custom#UnmarshalTOML().(interface{}) error { |
| 2260 | c.vscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Custom#v. = "called" |
| 2261 | return nil |
| 2262 | } |
| 2263 | |
| 2264 | func TestGitHubIssue431scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestGitHubIssue431().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2265 | doc := `key = "value"` |
| 2266 | var c Configscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Config# |
| 2267 | if err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(doc), &c); err != nil { |
| 2268 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("unexpected error: %s", err) |
| 2269 | } |
| 2270 | |
| 2271 | if c.Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Config#Key. != "value" { |
| 2272 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("expected c.Key='value', not '%s'", c.Keyscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Config#Key.) |
| 2273 | } |
| 2274 | |
| 2275 | if c.Objscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Config#Obj..vscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/Custom#v. == "called" { |
| 2276 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Errorf().("UnmarshalTOML should not have been called") |
| 2277 | } |
| 2278 | } |
| 2279 | |
| 2280 | type durationStringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/durationString# struct { |
| 2281 | timescip-go gomod github.com/golang/go/src go1.21.0 time/.Durationscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/durationString#Duration. |
| 2282 | } |
| 2283 | |
| 2284 | func (d *durationStringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/durationString#) UnmarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/durationString#UnmarshalTOML().(interface{}) error { |
| 2285 | d.Durationscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/durationString#Duration. = 10 * timescip-go gomod github.com/golang/go/src go1.21.0 time/.Secondscip-go gomod github.com/golang/go/src go1.21.0 time/Second. |
| 2286 | return nil |
| 2287 | } |
| 2288 | |
| 2289 | type config437Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437Error# struct{} |
| 2290 | |
| 2291 | func (e *config437Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437Error#) UnmarshalTOMLscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437Error#UnmarshalTOML().(interface{}) error { |
| 2292 | return errorsscip-go gomod github.com/golang/go/src go1.21.0 errors/.Newscip-go gomod github.com/golang/go/src go1.21.0 errors/New().("expected") |
| 2293 | } |
| 2294 | |
| 2295 | type config437scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437# struct { |
| 2296 | HTTPscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#HTTP. struct { |
| 2297 | PingTimeoutscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#$anon_a24413728d6f6f41#PingTimeout. durationStringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/durationString# `toml:"PingTimeout"` |
| 2298 | ErrorFieldscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#$anon_a24413728d6f6f41#ErrorField. config437Errorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437Error# |
| 2299 | } `toml:"HTTP"` |
| 2300 | } |
| 2301 | |
| 2302 | func TestGitHubIssue437scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestGitHubIssue437().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2303 | t.Skipfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Skipf().("unmarshalTOML not implemented") |
| 2304 | src := ` |
| 2305 | [HTTP] |
| 2306 | PingTimeout = "32m" |
| 2307 | ` |
| 2308 | cfg := &config437scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#{} |
| 2309 | cfg.HTTPscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#HTTP..PingTimeoutscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#$anon_a24413728d6f6f41#PingTimeout. = durationStringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/durationString#{timescip-go gomod github.com/golang/go/src go1.21.0 time/.Secondscip-go gomod github.com/golang/go/src go1.21.0 time/Second.} |
| 2310 | |
| 2311 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(src), cfg) |
| 2312 | if err != nil { |
| 2313 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("unexpected errors %s", err) |
| 2314 | } |
| 2315 | expected := durationStringscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/durationString#{10 * timescip-go gomod github.com/golang/go/src go1.21.0 time/.Secondscip-go gomod github.com/golang/go/src go1.21.0 time/Second.} |
| 2316 | if cfg.HTTPscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#HTTP..PingTimeoutscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#$anon_a24413728d6f6f41#PingTimeout. != expected { |
| 2317 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("expected '%s', got '%s'", expected, cfg.HTTPscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#HTTP..PingTimeoutscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#$anon_a24413728d6f6f41#PingTimeout.) |
| 2318 | } |
| 2319 | } |
| 2320 | |
| 2321 | func TestLeafUnmarshalerErrorscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/TestLeafUnmarshalerError().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 2322 | src := ` |
| 2323 | [HTTP] |
| 2324 | ErrorField = "foo" |
| 2325 | ` |
| 2326 | cfg := &config437scip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2/internal/imported_tests`/config437#{} |
| 2327 | |
| 2328 | err := tomlscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/.Unmarshalscip-go gomod github.com/pelletier/go-toml/v2 . `github.com/pelletier/go-toml/v2`/Unmarshal().([]byte(src), cfg) |
| 2329 | if err == nil { |
| 2330 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("error was expected") |
| 2331 | } |
| 2332 | } |