Debian Codegraph @

parsing/toml/toml_reader_test.go

raw symbols SCIP
1 package toml_testscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/
2
3 import (
4 "osscip-go gomod github.com/golang/go/src go1.25 os/"
5 "path/filepathscip-go gomod github.com/golang/go/src go1.25 `path/filepath`/"
6 "testingscip-go gomod github.com/golang/go/src go1.25 testing/"
7
8 "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/"
9 "github.com/tomwright/dasel/v3/parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/"
10 "github.com/tomwright/dasel/v3/parsing/tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/"
11 )
12
13 func tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().(data []byte, exp func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#) func(*testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
14 return func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
15 exp := exp()
16 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
17 if err != nil {
18 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
19 }
20
21 got, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(data)
22 if err != nil {
23 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("unexpected error: %v", err)
24 return
25 }
26
27 matchResult, err := got.Equalscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Equal().(exp)
28 if err != nil {
29 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
30 }
31 matchResultBool, err := matchResult.BoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#BoolValue().()
32 if err != nil {
33 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
34 }
35 if !matchResultBool {
36 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected\n%s\ngot\n%s", exp.Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#String().(), got.Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#String().())
37 }
38 }
39 }
40
41 func TestTomlReader_Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/TestTomlReader_Read().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
42 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("key value", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
43 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().(
44 "string",
45 tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`foo = "Bar"`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
46 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
47 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("foo", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("Bar"))
48 return res
49 }),
50 )
51
52 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().(
53 "int",
54 tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`foo = 123`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
55 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
56 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("foo", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(123))
57 return res
58 }),
59 )
60
61 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().(
62 "float",
63 tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`foo = 12.3`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
64 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
65 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("foo", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(12.3))
66 return res
67 }),
68 )
69
70 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().(
71 "true",
72 tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`foo = true`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
73 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
74 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("foo", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(true))
75 return res
76 }),
77 )
78
79 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().(
80 "false",
81 tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`foo = false`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
82 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
83 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("foo", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(false))
84 return res
85 }),
86 )
87 })
88
89 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("inline table", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`props = { key1 = "value1", key2 = "value2" }`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
90 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
91 inlineTable := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
92 _ = inlineTable.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("key1", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("value1"))
93 _ = inlineTable.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("key2", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("value2"))
94 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("props", inlineTable)
95 return res
96 }))
97
98 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("table", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`[props]
99 key1 = "value1"
100 key2 = "value2"`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
101 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
102 inlineTable := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
103 _ = inlineTable.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("key1", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("value1"))
104 _ = inlineTable.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("key2", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("value2"))
105 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("props", inlineTable)
106 return res
107 }))
108
109 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("array table", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`[[products]]
110 name = "foo"
111 id = 1
112
113 [[products]]
114 name = "bar"
115 id = 2`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
116 productsArray := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
117 product1 := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
118 _ = product1.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("name", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("foo"))
119 _ = product1.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("id", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
120 _ = productsArray.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(product1)
121
122 product2 := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
123 _ = product2.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("name", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("bar"))
124 _ = product2.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("id", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2))
125 _ = productsArray.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(product2)
126
127 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
128 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("products", productsArray)
129 return res
130 }))
131
132 // dataBytes := []byte(`title = "TOML Example"
133 //[owner]
134 //name = "Tom Preston-Werner"
135 //props = { key1 = "value1", key2 = "value2" }
136 //
137 //[[products]]
138 //name = "Hammer"
139 //sku = 738594937
140 //
141 //[[products]]
142 //name = "Screwdriver"
143 //sku = 12341234
144 //`)
145 // //dob = 1979-05-27T07:32:00-08:00
146 // dataModel := model.NewMapValue()
147 // //parsedTime, err := time.Parse(time.RFC3339, "1979-05-27T07:32:00-08:00")
148 // //if err != nil {
149 // // t.Fatalf("unexpected error: %v", err)
150 // //}
151 // ownerMap := model.NewMapValue()
152 // _ = ownerMap.SetMapKey("name", model.NewStringValue("Tom Preston-Werner"))
153 // //_ = ownerMap.SetMapKey("dob", model.NewValue(parsedTime))
154 // _ = dataModel.SetMapKey("title", model.NewStringValue("TOML Example"))
155 // _ = dataModel.SetMapKey("owner", ownerMap)
156 }
157
158 func TestTomlReader_MoreCasesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/TestTomlReader_MoreCases().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
159 // simple array of ints
160 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("simple array", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`nums = [1, 2, 3]`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
161 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
162 s := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
163 _ = s.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
164 _ = s.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2))
165 _ = s.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(3))
166 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("nums", s)
167 return res
168 }))
169
170 // mixed type array
171 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("mixed array", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`mix = [1, "two", true]`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
172 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
173 s := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
174 _ = s.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
175 _ = s.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("two"))
176 _ = s.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(true))
177 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("mix", s)
178 return res
179 }))
180
181 // inline nested table and array
182 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("inline nested table", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`props = { sub = { a = 1 }, arr = [1,2] }`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
183 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
184 props := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
185 sub := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
186 _ = sub.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("a", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
187 _ = props.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("sub", sub)
188 arr := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
189 _ = arr.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
190 _ = arr.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2))
191 _ = props.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("arr", arr)
192 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("props", props)
193 return res
194 }))
195
196 // quoted key with space
197 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("quoted key with space", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`"a b" = "val"`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
198 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
199 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("a b", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("val"))
200 return res
201 }))
202
203 // dotted+quoted mixture
204 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("dotted and quoted mixture", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`a."b.c".d = "x"`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
205 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
206 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
207 b := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
208 _ = b.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("d", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("x"))
209 _ = a.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("b.c", b)
210 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("a", a)
211 return res
212 }))
213
214 // negative integer
215 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("negative integer", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`n = -5`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
216 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
217 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("n", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(-5))
218 return res
219 }))
220
221 // scientific float
222 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("scientific float", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`f = 1e3`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
223 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
224 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("f", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(1000.0))
225 return res
226 }))
227
228 // array of inline tables
229 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("array of inline tables", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`items = [{a = 1}, {a = 2}]`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
230 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
231 items := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
232 p1 := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
233 _ = p1.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("a", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
234 _ = items.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(p1)
235 p2 := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
236 _ = p2.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("a", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2))
237 _ = items.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(p2)
238 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("items", items)
239 return res
240 }))
241
242 // nested tables using headers
243 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested table headers", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`[server]
244 ip = "127.0.0.1"
245 [server.db]
246 name = "maindb"`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
247 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
248 server := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
249 _ = server.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("ip", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("127.0.0.1"))
250 db := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
251 _ = db.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("name", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("maindb"))
252 _ = server.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("db", db)
253 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("server", server)
254 return res
255 }))
256
257 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("sub-table in array of tables", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`[[products]]
258 name = "Hammer"
259 sku = 738594937
260
261 [products.appearance]
262 color = "red"
263
264 [[products]]
265 name = "Screwdriver"
266 sku = 12341234`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
267 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
268 products := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
269 hammer := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
270 _ = hammer.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("name", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("Hammer"))
271 _ = hammer.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("sku", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(738594937))
272 appearance := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
273 _ = appearance.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("color", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("red"))
274 _ = hammer.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("appearance", appearance)
275 _ = products.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(hammer)
276 screwdriver := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
277 _ = screwdriver.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("name", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("Screwdriver"))
278 _ = screwdriver.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("sku", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(12341234))
279 _ = products.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(screwdriver)
280 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("products", products)
281 return res
282 }))
283 }
284
285 func TestTomlReader_QuotedKeysscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/TestTomlReader_QuotedKeys().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
286 // quoted single key with dot should be a single key
287 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("quoted single segment containing dot", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`"a.b" = 1`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
288 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
289 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("a.b", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
290 return res
291 }))
292
293 // unquoted dotted key should create nested maps
294 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("unquoted dotted key creates nested maps", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`a.b = 2`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
295 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
296 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
297 _ = a.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("b", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2))
298 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("a", a)
299 return res
300 }))
301
302 // mixture: first segment unquoted, second quoted containing dot
303 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("mixed quoted segment", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`a."b.c" = 3`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
304 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
305 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
306 _ = a.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("b.c", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(3))
307 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("a", a)
308 return res
309 }))
310 }
311
312 func TestTomlReader_ComplexFilescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/TestTomlReader_ComplexFile().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
313 dataPath := filepathscip-go gomod github.com/golang/go/src go1.25 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25 `path/filepath`/Join().("testdata", "complex_example.toml")
314 b, err := osscip-go gomod github.com/golang/go/src go1.25 os/.ReadFilescip-go gomod github.com/golang/go/src go1.25 os/ReadFile().(dataPath)
315 if err != nil {
316 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("failed reading test data: %v", err)
317 }
318
319 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
320 if err != nil {
321 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
322 }
323
324 val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(b)
325 if err != nil {
326 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error reading toml: %v", err)
327 }
328
329 // spot check some keys
330 owner, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("owner")
331 if err != nil {
332 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing owner: %v", err)
333 }
334 name, err := owner.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name")
335 if err != nil {
336 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing owner.name: %v", err)
337 }
338 if got, _ := name.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().(); got != "Tom Preston-Werner" {
339 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected owner.name: %s", got)
340 }
341
342 // quoted key
343 qk, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("quoted key")
344 if err != nil {
345 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing quoted key: %v", err)
346 }
347 if s, _ := qk.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().(); s != "quoted value" {
348 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected quoted key value: %s", s)
349 }
350
351 // products array length
352 products, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("products")
353 if err != nil {
354 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing products: %v", err)
355 }
356 if l, _ := products.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().(); l != 2 {
357 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 products, got %d", l)
358 }
359
360 // a.b quoted
361 ab, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("a.b")
362 if err != nil {
363 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing a.b: %v", err)
364 }
365 if i, _ := ab.IntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IntValue().(); i != 42 {
366 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected a.b: %d", i)
367 }
368
369 // nested table header value
370 db, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("database")
371 if err != nil {
372 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing database: %v", err)
373 }
374 rep, err := db.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("replica")
375 if err != nil {
376 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing database.replica: %v", err)
377 }
378 if n, _ := rep.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name"); n == nil {
379 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing database.replica.name")
380 }
381 }
382
383 func TestTomlReader_EdgeCasesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/TestTomlReader_EdgeCases().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
384 // conflict: scalar then dotted key
385 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("scalar then dotted key conflict", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
386 src := []byte("a = 1\na.b = 2")
387 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
388 if err != nil {
389 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
390 }
391 _, err = r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
392 if err == nil {
393 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected error for scalar then dotted key conflict, got nil")
394 }
395 })
396
397 // array-table conflict: scalar then array-table
398 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("scalar then array-table conflict", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
399 src := []byte("a = 1\n[[a]]\nname = \"x\"")
400 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
401 if err != nil {
402 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
403 }
404 _, err = r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
405 if err == nil {
406 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected error for scalar then array-table conflict, got nil")
407 }
408 })
409
410 // repeated table headers should merge keys
411 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("repeated explicit table headers merge", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
412 src := []byte("[t]\na = 1\n[t]\nb = 2")
413 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
414 if err != nil {
415 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
416 }
417 val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
418 if err != nil {
419 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
420 }
421 m, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("t")
422 if err != nil {
423 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing table t: %v", err)
424 }
425 if a, err := m.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("a"); err != nil || a == nil {
426 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected a in t: %v", err)
427 }
428 if b, err := m.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("b"); err != nil || b == nil {
429 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected b in t: %v", err)
430 }
431 })
432
433 // inline table then explicit table should merge
434 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("inline table then explicit header merges", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
435 src := []byte("t = {a = 1}\n[t]\nb = 2")
436 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
437 if err != nil {
438 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
439 }
440 val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
441 if err != nil {
442 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
443 }
444 m, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("t")
445 if err != nil {
446 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing table t: %v", err)
447 }
448 if a, err := m.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("a"); err != nil || a == nil {
449 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected a in t: %v", err)
450 }
451 if b, err := m.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("b"); err != nil || b == nil {
452 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected b in t: %v", err)
453 }
454 })
455
456 // integer overflow
457 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("integer overflow", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
458 src := []byte("big = 9223372036854775808") // int64 max + 1
459 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
460 if err != nil {
461 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
462 }
463 _, err = r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
464 if err == nil {
465 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected error for integer overflow, got nil")
466 }
467 })
468
469 // ensure arrays with trailing commas parse (already covered elsewhere but add explicit check)
470 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("array trailing comma parse", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
471 src := []byte("arr = [1,2,]")
472 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
473 if err != nil {
474 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
475 }
476 val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
477 if err != nil {
478 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
479 }
480 arr, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("arr")
481 if err != nil {
482 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing arr: %v", err)
483 }
484 if l, _ := arr.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().(); l != 2 {
485 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 items in arr, got %d", l)
486 }
487 })
488
489 // ensure arrays of inline tables types preserved
490 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("array of inline tables preserves types", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
491 src := []byte("items = [{a = 1}, {a = 2}]")
492 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
493 if err != nil {
494 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
495 }
496 val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
497 if err != nil {
498 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
499 }
500 items, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("items")
501 if err != nil {
502 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing items: %v", err)
503 }
504 if l, _ := items.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().(); l != 2 {
505 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 items, got %d", l)
506 }
507 // first element has a=1
508 it0, _ := items.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0)
509 if a, err := it0.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("a"); err != nil {
510 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing a in first item: %v", err)
511 } else if ai, _ := a.IntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IntValue().(); ai != 1 {
512 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected a in first item: %d", ai)
513 }
514 })
515 }
516
517 func TestTomlReader_NonBase10Numbersscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/TestTomlReader_NonBase10Numbers().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
518 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("hex", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`val = 0x12`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
519 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
520 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("val", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(18))
521 return res
522 }))
523
524 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("octal", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`val = 0o7`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
525 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
526 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("val", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(7))
527 return res
528 }))
529
530 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("binary", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`val = 0b111`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
531 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
532 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("val", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(7))
533 return res
534 }))
535
536 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("underscore decimal", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`val = 12_000`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
537 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
538 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("val", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(12000))
539 return res
540 }))
541
542 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("negative underscore decimal", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`val = -12_000`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
543 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
544 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("val", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(-12000))
545 return res
546 }))
547
548 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("negative int", tomlReaderTestscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/tomlReaderTest().([]byte(`val = -42`), func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
549 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
550 _ = res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("val", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(-42))
551 return res
552 }))
553 }
554
555 func TestTomlReader_TimeStringsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml_test`/TestTomlReader_TimeStrings().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
556 // Local date
557 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("local date string", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
558 src := []byte("d = 1979-05-27")
559 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
560 if err != nil {
561 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
562 }
563 val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
564 if err != nil {
565 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error parsing: %v", err)
566 }
567 v, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("d")
568 if err != nil {
569 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing key d: %v", err)
570 }
571 s, err := v.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().()
572 if err != nil {
573 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("value not string: %v", err)
574 }
575 if s != "1979-05-27" {
576 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected %q got %q", "1979-05-27", s)
577 }
578 })
579
580 // Local time
581 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("local time string", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
582 src := []byte("t = 07:32:00")
583 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
584 if err != nil {
585 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
586 }
587 val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
588 if err != nil {
589 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error parsing: %v", err)
590 }
591 v, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("t")
592 if err != nil {
593 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing key t: %v", err)
594 }
595 s, err := v.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().()
596 if err != nil {
597 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("value not string: %v", err)
598 }
599 if s != "07:32:00" {
600 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected %q got %q", "07:32:00", s)
601 }
602 })
603
604 // Local date-time
605 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("local datetime string", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
606 src := []byte("dt = 1979-05-27T07:32:00")
607 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
608 if err != nil {
609 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
610 }
611 val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
612 if err != nil {
613 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error parsing: %v", err)
614 }
615 v, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("dt")
616 if err != nil {
617 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing key dt: %v", err)
618 }
619 s, err := v.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().()
620 if err != nil {
621 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("value not string: %v", err)
622 }
623 if s != "1979-05-27T07:32:00" {
624 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected %q got %q", "1979-05-27T07:32:00", s)
625 }
626 })
627
628 // DateTime with timezone (RFC3339)
629 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("datetime with tz string", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
630 src := []byte("dt = 1979-05-27T07:32:00-08:00")
631 r, err := tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/.TOMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/TOML..NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultReaderOptions().())
632 if err != nil {
633 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error creating reader: %v", err)
634 }
635 val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(src)
636 if err != nil {
637 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error parsing: %v", err)
638 }
639 v, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("dt")
640 if err != nil {
641 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("missing key dt: %v", err)
642 }
643 s, err := v.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().()
644 if err != nil {
645 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("value not string: %v", err)
646 }
647 if s != "1979-05-27T07:32:00-08:00" {
648 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected %q got %q", "1979-05-27T07:32:00-08:00", s)
649 }
650 })
651 }