| 1 | package json_testscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "errorsscip-go gomod github.com/golang/go/src go1.25 errors/" |
| 5 | "stringsscip-go gomod github.com/golang/go/src go1.25 strings/" |
| 6 | "testingscip-go gomod github.com/golang/go/src go1.25 testing/" |
| 7 | |
| 8 | "github.com/google/go-cmp/cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/" |
| 9 | "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/" |
| 10 | "github.com/tomwright/dasel/v3/parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/" |
| 11 | "github.com/tomwright/dasel/v3/parsing/jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/" |
| 12 | ) |
| 13 | |
| 14 | func TestJsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json_test`/TestJson().(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 | doc := []byte(`{ |
| 16 | "string": "foo", |
| 17 | "int": 1, |
| 18 | "float": 1.1, |
| 19 | "bool": true, |
| 20 | "null": null, |
| 21 | "array": [ |
| 22 | 1, |
| 23 | 2, |
| 24 | 3 |
| 25 | ], |
| 26 | "object": { |
| 27 | "key": "value" |
| 28 | } |
| 29 | } |
| 30 | `) |
| 31 | reader, err := jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/.JSONscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/JSON..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().()) |
| 32 | if err != nil { |
| 33 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 34 | } |
| 35 | writer, err := jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/.JSONscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/JSON..NewWriterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewWriter().(parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultWriterOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultWriterOptions().()) |
| 36 | if err != nil { |
| 37 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 38 | } |
| 39 | |
| 40 | value, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(doc) |
| 41 | if err != nil { |
| 42 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 43 | } |
| 44 | |
| 45 | newDoc, err := writer.Writescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer#Write.(value) |
| 46 | if err != nil { |
| 47 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 48 | } |
| 49 | |
| 50 | if string(doc) != string(newDoc) { |
| 51 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected %s, got %s...\n%s", string(doc), string(newDoc), cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(string(doc), string(newDoc))) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | func TestJsonCompactscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json_test`/TestJsonCompact().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 56 | doc := []byte(`{ |
| 57 | "string": "foo", |
| 58 | "int": 1, |
| 59 | "float": 1.1, |
| 60 | "bool": true, |
| 61 | "null": null, |
| 62 | "array": [ |
| 63 | 1, |
| 64 | 2, |
| 65 | 3 |
| 66 | ], |
| 67 | "object": { |
| 68 | "key": "value" |
| 69 | } |
| 70 | } |
| 71 | `) |
| 72 | reader, err := jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/.JSONscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/JSON..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().()) |
| 73 | if err != nil { |
| 74 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 75 | } |
| 76 | opts := parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultWriterOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultWriterOptions().() |
| 77 | opts.Compactscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/WriterOptions#Compact. = true |
| 78 | writer, err := jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/.JSONscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/JSON..NewWriterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewWriter().(opts) |
| 79 | if err != nil { |
| 80 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 81 | } |
| 82 | |
| 83 | value, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(doc) |
| 84 | if err != nil { |
| 85 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 86 | } |
| 87 | |
| 88 | newDoc, err := writer.Writescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer#Write.(value) |
| 89 | if err != nil { |
| 90 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 91 | } |
| 92 | |
| 93 | expected := `{"string":"foo","int":1,"float":1.1,"bool":true,"null":null,"array":[1,2,3],"object":{"key":"value"}}` + "\n" |
| 94 | if string(newDoc) != expected { |
| 95 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected %s, got %s...\n%s", expected, string(newDoc), cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(expected, string(newDoc))) |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | func TestNDJSONscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json_test`/TestNDJSON().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 100 | newReader := 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#) 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# { |
| 101 | t.Helperscip-go gomod github.com/golang/go/src go1.25 testing/common#Helper().() |
| 102 | r, err := jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/.JSONscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/JSON..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().()) |
| 103 | if err != nil { |
| 104 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 105 | } |
| 106 | return r |
| 107 | } |
| 108 | |
| 109 | newWriter := 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#, compact bool) parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Writerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer# { |
| 110 | t.Helperscip-go gomod github.com/golang/go/src go1.25 testing/common#Helper().() |
| 111 | opts := parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.DefaultWriterOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/DefaultWriterOptions().() |
| 112 | opts.Compactscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/WriterOptions#Compact. = compact |
| 113 | w, err := jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/.JSONscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/JSON..NewWriterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewWriter().(opts) |
| 114 | if err != nil { |
| 115 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 116 | } |
| 117 | return parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.MultiDocumentWriterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/MultiDocumentWriter().(w) |
| 118 | } |
| 119 | |
| 120 | // readWrite is a helper that reads input, writes it back via MultiDocumentWriter, |
| 121 | // and compares the output to the expected string. |
| 122 | readWrite := 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#, input, expected string, compact bool) { |
| 123 | t.Helperscip-go gomod github.com/golang/go/src go1.25 testing/common#Helper().() |
| 124 | reader := newReader(t) |
| 125 | writer := newWriter(t, compact) |
| 126 | |
| 127 | value, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(input)) |
| 128 | if err != nil { |
| 129 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("read error: %v", err) |
| 130 | } |
| 131 | |
| 132 | out, err := writer.Writescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer#Write.(value) |
| 133 | if err != nil { |
| 134 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("write error: %v", err) |
| 135 | } |
| 136 | |
| 137 | if string(out) != expected { |
| 138 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected output:\n%s", cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(expected, string(out))) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | // assertValue is a helper that reads input and runs an assertion function against |
| 143 | // the parsed model.Value. |
| 144 | assertValue := 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#, input string, assert 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#, v *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#)) { |
| 145 | t.Helperscip-go gomod github.com/golang/go/src go1.25 testing/common#Helper().() |
| 146 | reader := newReader(t) |
| 147 | value, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(input)) |
| 148 | if err != nil { |
| 149 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("read error: %v", err) |
| 150 | } |
| 151 | assert(t, value) |
| 152 | } |
| 153 | |
| 154 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("single object unchanged", 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#) { |
| 155 | input := "{\"name\":\"Tom\"}\n" |
| 156 | assertValue(t, input, 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#, v *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#) { |
| 157 | if v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 158 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("single document should not be a branch") |
| 159 | } |
| 160 | got, err := v.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 161 | if err != nil { |
| 162 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 163 | } |
| 164 | s, err := got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 165 | if err != nil { |
| 166 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 167 | } |
| 168 | if s != "Tom" { |
| 169 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected Tom, got %s", s) |
| 170 | } |
| 171 | }) |
| 172 | }) |
| 173 | |
| 174 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("single array unchanged", 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#) { |
| 175 | input := "[1,2,3]\n" |
| 176 | assertValue(t, input, 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#, v *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#) { |
| 177 | if v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 178 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("single document should not be a branch") |
| 179 | } |
| 180 | length, err := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 181 | if err != nil { |
| 182 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 183 | } |
| 184 | if length != 3 { |
| 185 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected length 3, got %d", length) |
| 186 | } |
| 187 | }) |
| 188 | }) |
| 189 | |
| 190 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("single scalar unchanged", 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#) { |
| 191 | input := "42\n" |
| 192 | assertValue(t, input, 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#, v *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#) { |
| 193 | if v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 194 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("single document should not be a branch") |
| 195 | } |
| 196 | i, err := v.IntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IntValue().() |
| 197 | if err != nil { |
| 198 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 199 | } |
| 200 | if i != 42 { |
| 201 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 42, got %d", i) |
| 202 | } |
| 203 | }) |
| 204 | }) |
| 205 | |
| 206 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("two objects", 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#) { |
| 207 | input := "{\"name\":\"Tom\"}\n{\"name\":\"Jim\"}\n" |
| 208 | assertValue(t, input, 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#, v *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#) { |
| 209 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 210 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("multiple documents should be a branch") |
| 211 | } |
| 212 | length, err := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 213 | if err != nil { |
| 214 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 215 | } |
| 216 | if length != 2 { |
| 217 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 documents, got %d", length) |
| 218 | } |
| 219 | |
| 220 | for i, expected := range []string{"Tom", "Jim"} { |
| 221 | doc, err := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(i) |
| 222 | if err != nil { |
| 223 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 224 | } |
| 225 | got, err := doc.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 226 | if err != nil { |
| 227 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 228 | } |
| 229 | s, err := got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 230 | if err != nil { |
| 231 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 232 | } |
| 233 | if s != expected { |
| 234 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("doc %d: expected %s, got %s", i, expected, s) |
| 235 | } |
| 236 | } |
| 237 | }) |
| 238 | }) |
| 239 | |
| 240 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("three objects", 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#) { |
| 241 | input := "{\"a\":1}\n{\"b\":2}\n{\"c\":3}\n" |
| 242 | assertValue(t, input, 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#, v *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#) { |
| 243 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 244 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 245 | } |
| 246 | length, err := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 247 | if err != nil { |
| 248 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 249 | } |
| 250 | if length != 3 { |
| 251 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 3 documents, got %d", length) |
| 252 | } |
| 253 | }) |
| 254 | }) |
| 255 | |
| 256 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("mixed 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#) { |
| 257 | input := "{\"name\":\"Tom\"}\n[1,2,3]\n\"hello\"\n42\ntrue\nnull\n" |
| 258 | assertValue(t, input, 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#, v *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#) { |
| 259 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 260 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 261 | } |
| 262 | length, err := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 263 | if err != nil { |
| 264 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 265 | } |
| 266 | if length != 6 { |
| 267 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 6 documents, got %d", length) |
| 268 | } |
| 269 | |
| 270 | // Check object |
| 271 | doc0, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 272 | name, _ := doc0.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 273 | s, _ := name.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 274 | if s != "Tom" { |
| 275 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("doc 0: expected Tom, got %s", s) |
| 276 | } |
| 277 | |
| 278 | // Check array |
| 279 | doc1, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 280 | arrLen, _ := doc1.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 281 | if arrLen != 3 { |
| 282 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("doc 1: expected length 3, got %d", arrLen) |
| 283 | } |
| 284 | |
| 285 | // Check string |
| 286 | doc2, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(2) |
| 287 | s2, _ := doc2.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 288 | if s2 != "hello" { |
| 289 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("doc 2: expected hello, got %s", s2) |
| 290 | } |
| 291 | |
| 292 | // Check int |
| 293 | doc3, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(3) |
| 294 | i, _ := doc3.IntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IntValue().() |
| 295 | if i != 42 { |
| 296 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("doc 3: expected 42, got %d", i) |
| 297 | } |
| 298 | |
| 299 | // Check bool |
| 300 | doc4, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(4) |
| 301 | b, _ := doc4.BoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#BoolValue().() |
| 302 | if !b { |
| 303 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("doc 4: expected true") |
| 304 | } |
| 305 | |
| 306 | // Check null |
| 307 | doc5, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(5) |
| 308 | if doc5.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. { |
| 309 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("doc 5: expected null, got %s", doc5.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().()) |
| 310 | } |
| 311 | }) |
| 312 | }) |
| 313 | |
| 314 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("objects with no trailing newline", 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#) { |
| 315 | input := "{\"a\":1}\n{\"b\":2}" |
| 316 | assertValue(t, input, 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#, v *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#) { |
| 317 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 318 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 319 | } |
| 320 | length, err := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 321 | if err != nil { |
| 322 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 323 | } |
| 324 | if length != 2 { |
| 325 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 documents, got %d", length) |
| 326 | } |
| 327 | }) |
| 328 | }) |
| 329 | |
| 330 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("extra whitespace between documents", 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#) { |
| 331 | input := "{\"a\":1}\n\n\n{\"b\":2}\n" |
| 332 | assertValue(t, input, 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#, v *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#) { |
| 333 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 334 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 335 | } |
| 336 | length, err := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 337 | if err != nil { |
| 338 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 339 | } |
| 340 | if length != 2 { |
| 341 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 documents, got %d", length) |
| 342 | } |
| 343 | }) |
| 344 | }) |
| 345 | |
| 346 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("pretty printed objects on separate lines", 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#) { |
| 347 | input := "{\n \"name\": \"Tom\"\n}\n{\n \"name\": \"Jim\"\n}\n" |
| 348 | assertValue(t, input, 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#, v *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#) { |
| 349 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 350 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 351 | } |
| 352 | length, err := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 353 | if err != nil { |
| 354 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 355 | } |
| 356 | if length != 2 { |
| 357 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 documents, got %d", length) |
| 358 | } |
| 359 | }) |
| 360 | }) |
| 361 | |
| 362 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested objects", 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#) { |
| 363 | input := "{\"user\":{\"name\":\"Tom\",\"age\":30}}\n{\"user\":{\"name\":\"Jim\",\"age\":25}}\n" |
| 364 | assertValue(t, input, 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#, v *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#) { |
| 365 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 366 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 367 | } |
| 368 | |
| 369 | doc0, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 370 | user0, _ := doc0.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("user") |
| 371 | name0, _ := user0.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 372 | s0, _ := name0.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 373 | if s0 != "Tom" { |
| 374 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected Tom, got %s", s0) |
| 375 | } |
| 376 | age0, _ := user0.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("age") |
| 377 | a0, _ := age0.IntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IntValue().() |
| 378 | if a0 != 30 { |
| 379 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 30, got %d", a0) |
| 380 | } |
| 381 | |
| 382 | doc1, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 383 | user1, _ := doc1.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("user") |
| 384 | name1, _ := user1.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 385 | s1, _ := name1.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 386 | if s1 != "Jim" { |
| 387 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected Jim, got %s", s1) |
| 388 | } |
| 389 | }) |
| 390 | }) |
| 391 | |
| 392 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("empty input", 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#) { |
| 393 | assertValue(t, "", 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#, v *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#) { |
| 394 | if v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 395 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("empty input should not be a branch") |
| 396 | } |
| 397 | if v.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. { |
| 398 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected null, got %s", v.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().()) |
| 399 | } |
| 400 | }) |
| 401 | }) |
| 402 | |
| 403 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("whitespace only input", 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#) { |
| 404 | assertValue(t, " \n\n \n", 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#, v *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#) { |
| 405 | if v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 406 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("whitespace-only input should not be a branch") |
| 407 | } |
| 408 | if v.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. { |
| 409 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected null, got %s", v.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().()) |
| 410 | } |
| 411 | }) |
| 412 | }) |
| 413 | |
| 414 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("two scalar strings", 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#) { |
| 415 | input := "\"hello\"\n\"world\"\n" |
| 416 | assertValue(t, input, 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#, v *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#) { |
| 417 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 418 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 419 | } |
| 420 | doc0, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 421 | s0, _ := doc0.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 422 | if s0 != "hello" { |
| 423 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected hello, got %s", s0) |
| 424 | } |
| 425 | doc1, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 426 | s1, _ := doc1.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 427 | if s1 != "world" { |
| 428 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected world, got %s", s1) |
| 429 | } |
| 430 | }) |
| 431 | }) |
| 432 | |
| 433 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("two scalar ints", 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#) { |
| 434 | input := "1\n2\n" |
| 435 | assertValue(t, input, 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#, v *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#) { |
| 436 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 437 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 438 | } |
| 439 | doc0, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 440 | i0, _ := doc0.IntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IntValue().() |
| 441 | if i0 != 1 { |
| 442 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 1, got %d", i0) |
| 443 | } |
| 444 | doc1, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 445 | i1, _ := doc1.IntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IntValue().() |
| 446 | if i1 != 2 { |
| 447 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2, got %d", i1) |
| 448 | } |
| 449 | }) |
| 450 | }) |
| 451 | |
| 452 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("two arrays", 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#) { |
| 453 | input := "[1,2]\n[3,4]\n" |
| 454 | assertValue(t, input, 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#, v *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#) { |
| 455 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 456 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 457 | } |
| 458 | length, _ := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 459 | if length != 2 { |
| 460 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 documents, got %d", length) |
| 461 | } |
| 462 | |
| 463 | doc0, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 464 | l0, _ := doc0.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 465 | if l0 != 2 { |
| 466 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("doc 0: expected length 2, got %d", l0) |
| 467 | } |
| 468 | |
| 469 | doc1, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 470 | el, _ := doc1.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 471 | i, _ := el.IntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IntValue().() |
| 472 | if i != 3 { |
| 473 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("doc 1[0]: expected 3, got %d", i) |
| 474 | } |
| 475 | }) |
| 476 | }) |
| 477 | |
| 478 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("round trip compact two objects", 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#) { |
| 479 | input := "{\"name\":\"Tom\"}\n{\"name\":\"Jim\"}\n" |
| 480 | // Each document gets a trailing \n from the writer, plus \n separator between docs. |
| 481 | expected := "{\"name\":\"Tom\"}\n\n{\"name\":\"Jim\"}\n" |
| 482 | readWrite(t, input, expected, true) |
| 483 | }) |
| 484 | |
| 485 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("round trip compact single object", 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#) { |
| 486 | input := "{\"name\":\"Tom\"}\n" |
| 487 | expected := "{\"name\":\"Tom\"}\n" |
| 488 | readWrite(t, input, expected, true) |
| 489 | }) |
| 490 | |
| 491 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("round trip pretty two objects", 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#) { |
| 492 | input := "{\"name\":\"Tom\"}\n{\"name\":\"Jim\"}\n" |
| 493 | expected := "{\n \"name\": \"Tom\"\n}\n\n{\n \"name\": \"Jim\"\n}\n" |
| 494 | readWrite(t, input, expected, false) |
| 495 | }) |
| 496 | |
| 497 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("round trip compact mixed 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#) { |
| 498 | input := "{\"a\":1}\n[1,2]\n\"str\"\n42\ntrue\nnull\n" |
| 499 | expected := "{\"a\":1}\n\n[1,2]\n\n\"str\"\n\n42\n\ntrue\n\nnull\n" |
| 500 | readWrite(t, input, expected, true) |
| 501 | }) |
| 502 | |
| 503 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("objects separated by spaces", 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#) { |
| 504 | input := "{\"a\":1} {\"b\":2}" |
| 505 | assertValue(t, input, 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#, v *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#) { |
| 506 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 507 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 508 | } |
| 509 | length, _ := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 510 | if length != 2 { |
| 511 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 documents, got %d", length) |
| 512 | } |
| 513 | }) |
| 514 | }) |
| 515 | |
| 516 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("documents with float values", 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#) { |
| 517 | input := "{\"val\":1.5}\n{\"val\":2.5}\n" |
| 518 | assertValue(t, input, 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#, v *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 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 520 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 521 | } |
| 522 | doc0, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 523 | val0, _ := doc0.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("val") |
| 524 | f0, _ := val0.FloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#FloatValue().() |
| 525 | if f0 != 1.5 { |
| 526 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 1.5, got %f", f0) |
| 527 | } |
| 528 | doc1, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 529 | val1, _ := doc1.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("val") |
| 530 | f1, _ := val1.FloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#FloatValue().() |
| 531 | if f1 != 2.5 { |
| 532 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2.5, got %f", f1) |
| 533 | } |
| 534 | }) |
| 535 | }) |
| 536 | |
| 537 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("documents with null values", 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#) { |
| 538 | input := "{\"a\":null}\n{\"b\":null}\n" |
| 539 | assertValue(t, input, 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#, v *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#) { |
| 540 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 541 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 542 | } |
| 543 | doc0, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 544 | val0, _ := doc0.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("a") |
| 545 | if val0.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. { |
| 546 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected null, got %s", val0.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().()) |
| 547 | } |
| 548 | }) |
| 549 | }) |
| 550 | |
| 551 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("documents with boolean values", 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#) { |
| 552 | input := "{\"ok\":true}\n{\"ok\":false}\n" |
| 553 | assertValue(t, input, 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#, v *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#) { |
| 554 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 555 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 556 | } |
| 557 | doc0, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 558 | val0, _ := doc0.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("ok") |
| 559 | b0, _ := val0.BoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#BoolValue().() |
| 560 | if !b0 { |
| 561 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected true") |
| 562 | } |
| 563 | doc1, _ := v.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 564 | val1, _ := doc1.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("ok") |
| 565 | b1, _ := val1.BoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#BoolValue().() |
| 566 | if b1 { |
| 567 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected false") |
| 568 | } |
| 569 | }) |
| 570 | }) |
| 571 | |
| 572 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("documents with empty objects", 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#) { |
| 573 | input := "{}\n{}\n" |
| 574 | assertValue(t, input, 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#, v *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#) { |
| 575 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 576 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 577 | } |
| 578 | length, _ := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 579 | if length != 2 { |
| 580 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 documents, got %d", length) |
| 581 | } |
| 582 | }) |
| 583 | }) |
| 584 | |
| 585 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("documents with empty arrays", 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#) { |
| 586 | input := "[]\n[]\n" |
| 587 | assertValue(t, input, 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#, v *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#) { |
| 588 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 589 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 590 | } |
| 591 | length, _ := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 592 | if length != 2 { |
| 593 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 2 documents, got %d", length) |
| 594 | } |
| 595 | }) |
| 596 | }) |
| 597 | |
| 598 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("large number of documents", 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#) { |
| 599 | input := "" |
| 600 | for i := 0; i < 100; i++ { |
| 601 | input += "{\"i\":" + string(rune('0'+i%10)) + "}\n" |
| 602 | } |
| 603 | // Use a simpler approach - just build manually |
| 604 | input = "" |
| 605 | for i := 0; i < 100; i++ { |
| 606 | input += "{\"i\":1}\n" |
| 607 | } |
| 608 | assertValue(t, input, 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#, v *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#) { |
| 609 | if !v.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 610 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected branch") |
| 611 | } |
| 612 | length, err := v.SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().() |
| 613 | if err != nil { |
| 614 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 615 | } |
| 616 | if length != 100 { |
| 617 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected 100 documents, got %d", length) |
| 618 | } |
| 619 | }) |
| 620 | }) |
| 621 | } |
| 622 | |
| 623 | func TestJSONReader_DepthLimitscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json_test`/TestJSONReader_DepthLimit().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 624 | reader, err := jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/.JSONscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/JSON..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().()) |
| 625 | if err != nil { |
| 626 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 627 | } |
| 628 | |
| 629 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested arrays exceeding limit return error", 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 | // 10_001 levels of nested arrays — one past the 10_000 limit. |
| 631 | const depth = 10_001 |
| 632 | data := []byte(stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25 strings/Repeat().("[", depth) + stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25 strings/Repeat().("]", depth)) |
| 633 | _, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(data) |
| 634 | if !errorsscip-go gomod github.com/golang/go/src go1.25 errors/.Isscip-go gomod github.com/golang/go/src go1.25 errors/Is().(err, jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/.ErrJSONMaxDepthExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/ErrJSONMaxDepthExceeded.) { |
| 635 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected ErrJSONMaxDepthExceeded, got %v", err) |
| 636 | } |
| 637 | }) |
| 638 | |
| 639 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested objects exceeding limit return error", 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#) { |
| 640 | const depth = 10_001 |
| 641 | data := []byte(stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25 strings/Repeat().(`{"x":`, depth) + `"v"` + stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25 strings/Repeat().("}", depth)) |
| 642 | _, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(data) |
| 643 | if !errorsscip-go gomod github.com/golang/go/src go1.25 errors/.Isscip-go gomod github.com/golang/go/src go1.25 errors/Is().(err, jsonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/.ErrJSONMaxDepthExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/json`/ErrJSONMaxDepthExceeded.) { |
| 644 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected ErrJSONMaxDepthExceeded, got %v", err) |
| 645 | } |
| 646 | }) |
| 647 | |
| 648 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("normal nesting within limit succeeds", 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#) { |
| 649 | data := []byte(`{"a":{"b":{"c":"d"}}}`) |
| 650 | _, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(data) |
| 651 | if err != nil { |
| 652 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err) |
| 653 | } |
| 654 | }) |
| 655 | } |