| 1 | package kdlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25 testing/" |
| 5 | |
| 6 | "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/" |
| 7 | "github.com/tomwright/dasel/v3/parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/" |
| 8 | ) |
| 9 | |
| 10 | func newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Readerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader# { |
| 11 | t.Helperscip-go gomod github.com/golang/go/src go1.25 testing/common#Helper().() |
| 12 | r, err := newKDLReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newKDLReader().(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().()) |
| 13 | if err != nil { |
| 14 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 15 | } |
| 16 | return r |
| 17 | } |
| 18 | |
| 19 | func TestReader_ScalarNodesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/TestReader_ScalarNodes().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 20 | r := newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t) |
| 21 | val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(`name "Bob" |
| 22 | age 76 |
| 23 | active true`)) |
| 24 | if err != nil { |
| 25 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 26 | } |
| 27 | |
| 28 | assertMapStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapStringValue().(t, val, "name", "Bob") |
| 29 | assertMapIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapIntValue().(t, val, "age", 76) |
| 30 | assertMapBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapBoolValue().(t, val, "active", true) |
| 31 | } |
| 32 | |
| 33 | func TestReader_DuplicateNodesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/TestReader_DuplicateNodes().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 34 | r := newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t) |
| 35 | val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(`plugin "git" |
| 36 | plugin "docker"`)) |
| 37 | if err != nil { |
| 38 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 39 | } |
| 40 | |
| 41 | plugins, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("plugin") |
| 42 | if err != nil { |
| 43 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 44 | } |
| 45 | if plugins.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().() != modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeSlice. { |
| 46 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected slice, got %s", plugins.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().()) |
| 47 | } |
| 48 | length, err := plugins.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 49 | if err != nil { |
| 50 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 51 | } |
| 52 | if length != 2 { |
| 53 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 plugins, got %d", length) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | func TestReader_NodeWithChildrenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/TestReader_NodeWithChildren().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 58 | r := newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t) |
| 59 | val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(`server 80 host="localhost" { |
| 60 | tls true |
| 61 | }`)) |
| 62 | if err != nil { |
| 63 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 64 | } |
| 65 | |
| 66 | server, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("server") |
| 67 | if err != nil { |
| 68 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 69 | } |
| 70 | |
| 71 | // Check $args |
| 72 | args, err := server.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("$args") |
| 73 | if err != nil { |
| 74 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 75 | } |
| 76 | if args.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().() != modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeSlice. { |
| 77 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected slice for $args, got %s", args.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().()) |
| 78 | } |
| 79 | |
| 80 | // Check host property |
| 81 | assertMapStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapStringValue().(t, server, "host", "localhost") |
| 82 | |
| 83 | // Check tls child |
| 84 | assertMapBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapBoolValue().(t, server, "tls", true) |
| 85 | } |
| 86 | |
| 87 | func TestReader_EmptyNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/TestReader_EmptyNode().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 88 | r := newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t) |
| 89 | val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(`empty-node`)) |
| 90 | if err != nil { |
| 91 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 92 | } |
| 93 | |
| 94 | node, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("empty-node") |
| 95 | if err != nil { |
| 96 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 97 | } |
| 98 | if node.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().() != modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeNullscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeNull. { |
| 99 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected null, got %s", node.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().()) |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | func TestReader_EmptyDocumentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/TestReader_EmptyDocument().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 104 | r := newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t) |
| 105 | val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(``)) |
| 106 | if err != nil { |
| 107 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 108 | } |
| 109 | if val.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().() != modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeMap. { |
| 110 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected map, got %s", val.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().()) |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | func TestReader_NestedChildrenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/TestReader_NestedChildren().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 115 | r := newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t) |
| 116 | val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(`a { |
| 117 | b { |
| 118 | c "deep" |
| 119 | } |
| 120 | }`)) |
| 121 | if err != nil { |
| 122 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 123 | } |
| 124 | |
| 125 | a, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("a") |
| 126 | if err != nil { |
| 127 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 128 | } |
| 129 | b, err := a.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("b") |
| 130 | if err != nil { |
| 131 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 132 | } |
| 133 | assertMapStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapStringValue().(t, b, "c", "deep") |
| 134 | } |
| 135 | |
| 136 | func TestReader_V2Keywordsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/TestReader_V2Keywords().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 137 | r := newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t) |
| 138 | val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(`node #true #false #null`)) |
| 139 | if err != nil { |
| 140 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 141 | } |
| 142 | |
| 143 | node, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("node") |
| 144 | if err != nil { |
| 145 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 146 | } |
| 147 | // Should be a map with $args |
| 148 | args, err := node.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("$args") |
| 149 | if err != nil { |
| 150 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 151 | } |
| 152 | |
| 153 | elem0, err := args.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 154 | if err != nil { |
| 155 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 156 | } |
| 157 | b, err := elem0.BoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#BoolValue().() |
| 158 | if err != nil { |
| 159 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 160 | } |
| 161 | if !b { |
| 162 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected true, got false") |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | func TestReader_NumberTypesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/TestReader_NumberTypes().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 167 | r := newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t) |
| 168 | val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(`hex 0xff |
| 169 | octal 0o77 |
| 170 | binary 0b1010 |
| 171 | float 3.14`)) |
| 172 | if err != nil { |
| 173 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 174 | } |
| 175 | |
| 176 | assertMapIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapIntValue().(t, val, "hex", 255) |
| 177 | assertMapIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapIntValue().(t, val, "octal", 63) |
| 178 | assertMapIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapIntValue().(t, val, "binary", 10) |
| 179 | assertMapFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapFloatValue().(t, val, "float", 3.14) |
| 180 | } |
| 181 | |
| 182 | func TestReader_MultipleArgumentsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/TestReader_MultipleArguments().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 183 | r := newTestReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/newTestReader().(t) |
| 184 | val, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(`node 1 2 3`)) |
| 185 | if err != nil { |
| 186 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 187 | } |
| 188 | |
| 189 | node, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("node") |
| 190 | if err != nil { |
| 191 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 192 | } |
| 193 | |
| 194 | args, err := node.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("$args") |
| 195 | if err != nil { |
| 196 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 197 | } |
| 198 | |
| 199 | length, err := args.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 200 | if err != nil { |
| 201 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 202 | } |
| 203 | if length != 3 { |
| 204 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 3 args, got %d", length) |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | // Helpers |
| 209 | |
| 210 | func assertMapStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapStringValue().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#, val *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#, key, expected string) { |
| 211 | t.Helperscip-go gomod github.com/golang/go/src go1.25 testing/common#Helper().() |
| 212 | v, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().(key) |
| 213 | if err != nil { |
| 214 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("key %q: %v", key, err) |
| 215 | } |
| 216 | s, err := v.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 217 | if err != nil { |
| 218 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("key %q string: %v", key, err) |
| 219 | } |
| 220 | if s != expected { |
| 221 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("key %q: expected %q, got %q", key, expected, s) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | func assertMapIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapIntValue().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#, val *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#, key string, expected int64) { |
| 226 | t.Helperscip-go gomod github.com/golang/go/src go1.25 testing/common#Helper().() |
| 227 | v, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().(key) |
| 228 | if err != nil { |
| 229 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("key %q: %v", key, err) |
| 230 | } |
| 231 | n, err := v.IntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IntValue().() |
| 232 | if err != nil { |
| 233 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("key %q int: %v", key, err) |
| 234 | } |
| 235 | if n != expected { |
| 236 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("key %q: expected %d, got %d", key, expected, n) |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | func assertMapFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapFloatValue().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#, val *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#, key string, expected float64) { |
| 241 | t.Helperscip-go gomod github.com/golang/go/src go1.25 testing/common#Helper().() |
| 242 | v, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().(key) |
| 243 | if err != nil { |
| 244 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("key %q: %v", key, err) |
| 245 | } |
| 246 | f, err := v.FloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#FloatValue().() |
| 247 | if err != nil { |
| 248 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("key %q float: %v", key, err) |
| 249 | } |
| 250 | if f != expected { |
| 251 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("key %q: expected %f, got %f", key, expected, f) |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | func assertMapBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/kdl`/assertMapBoolValue().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#, val *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#, key string, expected bool) { |
| 256 | t.Helperscip-go gomod github.com/golang/go/src go1.25 testing/common#Helper().() |
| 257 | v, err := val.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().(key) |
| 258 | if err != nil { |
| 259 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("key %q: %v", key, err) |
| 260 | } |
| 261 | b, err := v.BoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#BoolValue().() |
| 262 | if err != nil { |
| 263 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("key %q bool: %v", key, err) |
| 264 | } |
| 265 | if b != expected { |
| 266 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("key %q: expected %v, got %v", key, expected, b) |
| 267 | } |
| 268 | } |