| 1 | package yaml_testscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.25 bytes/" |
| 5 | "errorsscip-go gomod github.com/golang/go/src go1.25 errors/" |
| 6 | "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/" |
| 7 | "testingscip-go gomod github.com/golang/go/src go1.25 testing/" |
| 8 | "timescip-go gomod github.com/golang/go/src go1.25 time/" |
| 9 | |
| 10 | "github.com/google/go-cmp/cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/" |
| 11 | "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/" |
| 12 | "github.com/tomwright/dasel/v3/parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/" |
| 13 | "github.com/tomwright/dasel/v3/parsing/yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/" |
| 14 | ) |
| 15 | |
| 16 | type testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase# struct { |
| 17 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#in. string |
| 18 | assertscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#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#, res *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#) |
| 19 | } |
| 20 | |
| 21 | func (tc testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#) runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#run().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 22 | r, err := yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.YAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/YAML..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().()) |
| 23 | if err != nil { |
| 24 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 25 | } |
| 26 | res, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(tc.inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#in.)) |
| 27 | if err != nil { |
| 28 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 29 | } |
| 30 | |
| 31 | tc.assertscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#assert.(t, res) |
| 32 | } |
| 33 | |
| 34 | type rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase# struct { |
| 35 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in. string |
| 36 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out. string |
| 37 | } |
| 38 | |
| 39 | func (tc rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#) runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 40 | if tc.outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out. == "" { |
| 41 | tc.outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out. = tc.inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in. |
| 42 | } |
| 43 | r, err := yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.YAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/YAML..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().()) |
| 44 | if err != nil { |
| 45 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 46 | } |
| 47 | w, err := yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.YAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/YAML..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`/.WriterOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/WriterOptions#{}) |
| 48 | if err != nil { |
| 49 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 50 | } |
| 51 | res, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(tc.inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.)) |
| 52 | if err != nil { |
| 53 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 54 | } |
| 55 | out, err := w.Writescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer#Write.(res) |
| 56 | if err != nil { |
| 57 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 58 | } |
| 59 | |
| 60 | if !bytesscip-go gomod github.com/golang/go/src go1.25 bytes/.Equalscip-go gomod github.com/golang/go/src go1.25 bytes/Equal().([]byte(tc.outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.), out) { |
| 61 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("unexpected output: %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().(tc.outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out., string(out))) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func TestYamlWriter_Compactscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/TestYamlWriter_Compact().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 66 | r, err := yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.YAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/YAML..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().()) |
| 67 | if err != nil { |
| 68 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 69 | } |
| 70 | 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().() |
| 71 | opts.Compactscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/WriterOptions#Compact. = true |
| 72 | w, err := yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.YAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/YAML..NewWriterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewWriter().(opts) |
| 73 | if err != nil { |
| 74 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 75 | } |
| 76 | |
| 77 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("map", 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#) { |
| 78 | res, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte("a: 1\nb: 2\n")) |
| 79 | if err != nil { |
| 80 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 81 | } |
| 82 | out, err := w.Writescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer#Write.(res) |
| 83 | if err != nil { |
| 84 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 85 | } |
| 86 | expected := "{a: 1, b: 2}\n" |
| 87 | if string(out) != expected { |
| 88 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected %q, got %q", expected, string(out)) |
| 89 | } |
| 90 | }) |
| 91 | |
| 92 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("sequence", 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#) { |
| 93 | res, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte("- 1\n- 2\n- 3\n")) |
| 94 | if err != nil { |
| 95 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 96 | } |
| 97 | out, err := w.Writescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer#Write.(res) |
| 98 | if err != nil { |
| 99 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 100 | } |
| 101 | expected := "[1, 2, 3]\n" |
| 102 | if string(out) != expected { |
| 103 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected %q, got %q", expected, string(out)) |
| 104 | } |
| 105 | }) |
| 106 | |
| 107 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested", 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#) { |
| 108 | res, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte("map:\n key: value\nlist:\n - item1\n - item2\n")) |
| 109 | if err != nil { |
| 110 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 111 | } |
| 112 | out, err := w.Writescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer#Write.(res) |
| 113 | if err != nil { |
| 114 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 115 | } |
| 116 | expected := "{map: {key: value}, list: [item1, item2]}\n" |
| 117 | if string(out) != expected { |
| 118 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected %q, got %q", expected, string(out)) |
| 119 | } |
| 120 | }) |
| 121 | } |
| 122 | |
| 123 | func TestYamlValue_UnmarshalYAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/TestYamlValue_UnmarshalYAML().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 124 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("simple key value", testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#{ |
| 125 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#in.: `name: Tom`, |
| 126 | assertscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#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#, res *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#) { |
| 127 | got, err := res.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 128 | if err != nil { |
| 129 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 130 | } |
| 131 | |
| 132 | gotStr, err := got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 133 | if err != nil { |
| 134 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 135 | } |
| 136 | |
| 137 | if gotStr != "Tom" { |
| 138 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("unexpected value: %s", gotStr) |
| 139 | } |
| 140 | }, |
| 141 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#run().) |
| 142 | |
| 143 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("multi document", testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#{ |
| 144 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#in.: `name: Tom |
| 145 | --- |
| 146 | name: Jerry`, |
| 147 | assertscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#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#, res *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#) { |
| 148 | a, err := res.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 149 | if err != nil { |
| 150 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 151 | } |
| 152 | got, err := a.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 153 | if err != nil { |
| 154 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 155 | } |
| 156 | gotStr, err := got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 157 | if err != nil { |
| 158 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 159 | } |
| 160 | if gotStr != "Tom" { |
| 161 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("unexpected value: %s", gotStr) |
| 162 | } |
| 163 | |
| 164 | b, err := res.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 165 | if err != nil { |
| 166 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 167 | } |
| 168 | got, err = b.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 169 | if err != nil { |
| 170 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 171 | } |
| 172 | gotStr, err = got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 173 | if err != nil { |
| 174 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 175 | } |
| 176 | if gotStr != "Jerry" { |
| 177 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("unexpected value: %s", gotStr) |
| 178 | } |
| 179 | }, |
| 180 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#run().) |
| 181 | |
| 182 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("multi document", testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#{ |
| 183 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#in.: `name: Tom |
| 184 | --- |
| 185 | name: Jerry`, |
| 186 | assertscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#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#, res *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#) { |
| 187 | a, err := res.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 188 | if err != nil { |
| 189 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 190 | } |
| 191 | got, err := a.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 192 | if err != nil { |
| 193 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 194 | } |
| 195 | gotStr, err := got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 196 | if err != nil { |
| 197 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 198 | } |
| 199 | if gotStr != "Tom" { |
| 200 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("unexpected value: %s", gotStr) |
| 201 | } |
| 202 | |
| 203 | b, err := res.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 204 | if err != nil { |
| 205 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 206 | } |
| 207 | got, err = b.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name") |
| 208 | if err != nil { |
| 209 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 210 | } |
| 211 | gotStr, err = got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 212 | if err != nil { |
| 213 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 214 | } |
| 215 | if gotStr != "Jerry" { |
| 216 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("unexpected value: %s", gotStr) |
| 217 | } |
| 218 | }, |
| 219 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/testCase#run().) |
| 220 | |
| 221 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("multi document", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 222 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `name: Tom |
| 223 | --- |
| 224 | name: Jerry |
| 225 | `, |
| 226 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 227 | |
| 228 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("generic", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 229 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `str: foo |
| 230 | int: 1 |
| 231 | float: 1.1 |
| 232 | bool: true |
| 233 | map: |
| 234 | key: value |
| 235 | list: |
| 236 | - item1 |
| 237 | - item2 |
| 238 | `, |
| 239 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 240 | |
| 241 | // This test is technically wrong because we're only supporting the alias on read and not write. |
| 242 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("alias", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 243 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `name: &name Tom |
| 244 | name2: *name |
| 245 | `, |
| 246 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `name: Tom |
| 247 | name2: Tom |
| 248 | `, |
| 249 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 250 | |
| 251 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("null read write", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 252 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `name: null |
| 253 | `, |
| 254 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `name: null |
| 255 | `, |
| 256 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 257 | |
| 258 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("null document read write", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 259 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `null |
| 260 | `, |
| 261 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `null |
| 262 | `, |
| 263 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 264 | |
| 265 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("base numbers", 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#) { |
| 266 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("standard", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 267 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `10 |
| 268 | `, |
| 269 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `10 |
| 270 | `, |
| 271 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 272 | |
| 273 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("zero", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 274 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `0 |
| 275 | `, |
| 276 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `0 |
| 277 | `, |
| 278 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 279 | |
| 280 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("negative", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 281 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `-42 |
| 282 | `, |
| 283 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `-42 |
| 284 | `, |
| 285 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 286 | |
| 287 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("hex lowercase", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 288 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `0x10 |
| 289 | `, |
| 290 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `16 |
| 291 | `, |
| 292 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 293 | |
| 294 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("hex uppercase letters", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 295 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `0xff |
| 296 | `, |
| 297 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `255 |
| 298 | `, |
| 299 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 300 | |
| 301 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("octal", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 302 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `0o10 |
| 303 | `, |
| 304 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `8 |
| 305 | `, |
| 306 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 307 | |
| 308 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("binary", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 309 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `0b10 |
| 310 | `, |
| 311 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `2 |
| 312 | `, |
| 313 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 314 | |
| 315 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("leading zero is decimal", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 316 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `010 |
| 317 | `, |
| 318 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `10 |
| 319 | `, |
| 320 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 321 | |
| 322 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("hex in map", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 323 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `val: 0x10 |
| 324 | `, |
| 325 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `val: 16 |
| 326 | `, |
| 327 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 328 | |
| 329 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("octal in map", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 330 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `val: 0o77 |
| 331 | `, |
| 332 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `val: 63 |
| 333 | `, |
| 334 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 335 | |
| 336 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("mixed types in map", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 337 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `dec: 42 |
| 338 | hex: 0xff |
| 339 | oct: 0o77 |
| 340 | bin: 0b1010 |
| 341 | `, |
| 342 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `dec: 42 |
| 343 | hex: 255 |
| 344 | oct: 63 |
| 345 | bin: 10 |
| 346 | `, |
| 347 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 348 | |
| 349 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("positive sign", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 350 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `+42 |
| 351 | `, |
| 352 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `42 |
| 353 | `, |
| 354 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 355 | |
| 356 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("positive hex", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 357 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `+0x10 |
| 358 | `, |
| 359 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `16 |
| 360 | `, |
| 361 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 362 | |
| 363 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("positive octal", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 364 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `+0o10 |
| 365 | `, |
| 366 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `8 |
| 367 | `, |
| 368 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 369 | |
| 370 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("positive binary", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 371 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `+0b10 |
| 372 | `, |
| 373 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `2 |
| 374 | `, |
| 375 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 376 | |
| 377 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("negative hex", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 378 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `-0x10 |
| 379 | `, |
| 380 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `-16 |
| 381 | `, |
| 382 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 383 | |
| 384 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("negative octal", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 385 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `-0o10 |
| 386 | `, |
| 387 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `-8 |
| 388 | `, |
| 389 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 390 | |
| 391 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("negative binary", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 392 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `-0b10 |
| 393 | `, |
| 394 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `-2 |
| 395 | `, |
| 396 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 397 | |
| 398 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("underscore decimal", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 399 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `1_000 |
| 400 | `, |
| 401 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `1000 |
| 402 | `, |
| 403 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 404 | |
| 405 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("underscore hex", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 406 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `0xFF_FF |
| 407 | `, |
| 408 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `65535 |
| 409 | `, |
| 410 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 411 | |
| 412 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("underscore binary", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 413 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `0b1010_1010 |
| 414 | `, |
| 415 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: `170 |
| 416 | `, |
| 417 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 418 | }) |
| 419 | |
| 420 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("bounded yaml expansion", 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#) { |
| 421 | in := `a: &a ["lol","lol","lol","lol","lol","lol","lol","lol","lol"] |
| 422 | b: &b [*a,*a,*a,*a,*a,*a,*a,*a,*a] |
| 423 | c: &c [*b,*b,*b,*b,*b,*b,*b,*b,*b] |
| 424 | d: &d [*c,*c,*c,*c,*c,*c,*c,*c,*c] |
| 425 | e: &e [*d,*d,*d,*d,*d,*d,*d,*d,*d] |
| 426 | f: &f [*e,*e,*e,*e,*e,*e,*e,*e,*e] |
| 427 | g: &g [*f,*f,*f,*f,*f,*f,*f,*f,*f] |
| 428 | h: &h [*g,*g,*g,*g,*g,*g,*g,*g,*g] |
| 429 | i: &i [*h,*h,*h,*h,*h,*h,*h,*h,*h] |
| 430 | ` |
| 431 | |
| 432 | reader, err := parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#("yaml").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().()) |
| 433 | if err != nil { |
| 434 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 435 | } |
| 436 | |
| 437 | var gotErr error |
| 438 | |
| 439 | maxWaitTime := 10 * timescip-go gomod github.com/golang/go/src go1.25 time/.Secondscip-go gomod github.com/golang/go/src go1.25 time/Second. |
| 440 | gotErrCh := make(chan error) |
| 441 | go func() { |
| 442 | _, gotErr = reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(in)) |
| 443 | gotErrCh <- gotErr |
| 444 | }() |
| 445 | |
| 446 | select { |
| 447 | case gotErr = <-gotErrCh: |
| 448 | if gotErr == nil { |
| 449 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected error, got nil") |
| 450 | } |
| 451 | if !errorsscip-go gomod github.com/golang/go/src go1.25 errors/.Isscip-go gomod github.com/golang/go/src go1.25 errors/Is().(gotErr, yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.ErrYamlExpansionDepthExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/ErrYamlExpansionDepthExceeded.) && !errorsscip-go gomod github.com/golang/go/src go1.25 errors/.Isscip-go gomod github.com/golang/go/src go1.25 errors/Is().(gotErr, yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.ErrYamlExpansionBudgetExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/ErrYamlExpansionBudgetExceeded.) { |
| 452 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", gotErr) |
| 453 | } |
| 454 | case <-timescip-go gomod github.com/golang/go/src go1.25 time/.Afterscip-go gomod github.com/golang/go/src go1.25 time/After().(maxWaitTime): |
| 455 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected error within %s, but did not get one", maxWaitTime) |
| 456 | } |
| 457 | }) |
| 458 | |
| 459 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("alias metadata is preserved", 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#) { |
| 460 | r, err := yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.YAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/YAML..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().()) |
| 461 | if err != nil { |
| 462 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 463 | } |
| 464 | |
| 465 | res, err := r.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte("name: &name Tom\nname2: *name\n")) |
| 466 | if err != nil { |
| 467 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 468 | } |
| 469 | |
| 470 | aliasValue, err := res.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("name2") |
| 471 | if err != nil { |
| 472 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 473 | } |
| 474 | |
| 475 | got, ok := aliasValue.MetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MetadataValue().("yaml-alias") |
| 476 | if !ok { |
| 477 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected yaml-alias metadata to be set") |
| 478 | } |
| 479 | if got != "name" { |
| 480 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected yaml-alias metadata: %v", got) |
| 481 | } |
| 482 | }) |
| 483 | |
| 484 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("yaml expansion depth boundary", 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#) { |
| 485 | reader, err := parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#("yaml").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().()) |
| 486 | if err != nil { |
| 487 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 488 | } |
| 489 | |
| 490 | makeDoc := func(depth int) string { |
| 491 | if depth == 0 { |
| 492 | return "root0: &root0 [value]\nresult: *root0\n" |
| 493 | } |
| 494 | |
| 495 | res := "root0: &root0 [value]\n" |
| 496 | for i := 1; i <= depth; i++ { |
| 497 | res += fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25 fmt/Sprintf().("root%d: &root%d [*root%d]\n", i, i, i-1) |
| 498 | } |
| 499 | res += fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25 fmt/Sprintf().("result: *root%d\n", depth) |
| 500 | return res |
| 501 | } |
| 502 | |
| 503 | depthLimit := 32 |
| 504 | for _, tc := range []struct { |
| 505 | name string |
| 506 | depth int |
| 507 | wantErr bool |
| 508 | }{ |
| 509 | {name: "within limit", depth: depthLimit - 2, wantErr: false}, |
| 510 | {name: "at limit", depth: depthLimit - 1, wantErr: false}, |
| 511 | {name: "over limit", depth: depthLimit, wantErr: true}, |
| 512 | } { |
| 513 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().(tc.name, 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#) { |
| 514 | res, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(makeDoc(tc.depth))) |
| 515 | if tc.wantErr { |
| 516 | if err == nil { |
| 517 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected error, got nil") |
| 518 | } |
| 519 | 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, yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.ErrYamlExpansionDepthExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/ErrYamlExpansionDepthExceeded.) { |
| 520 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err) |
| 521 | } |
| 522 | return |
| 523 | } |
| 524 | |
| 525 | if err != nil { |
| 526 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 527 | } |
| 528 | |
| 529 | result, err := res.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("result") |
| 530 | if err != nil { |
| 531 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 532 | } |
| 533 | for i := 0; i <= tc.depth; i++ { |
| 534 | result, err = result.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 535 | if err != nil { |
| 536 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error at nested index %d: %s", i, err) |
| 537 | } |
| 538 | } |
| 539 | got, err := result.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 540 | if err != nil { |
| 541 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 542 | } |
| 543 | if got != "value" { |
| 544 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected value: %s", got) |
| 545 | } |
| 546 | }) |
| 547 | } |
| 548 | }) |
| 549 | |
| 550 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("yaml expansion budget boundary", 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#) { |
| 551 | reader, err := parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#("yaml").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().()) |
| 552 | if err != nil { |
| 553 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 554 | } |
| 555 | |
| 556 | makeDoc := func(aliasCount int) string { |
| 557 | res := "root: &root value\nitems:\n" |
| 558 | for i := 0; i < aliasCount; i++ { |
| 559 | res += " - *root\n" |
| 560 | } |
| 561 | return res |
| 562 | } |
| 563 | |
| 564 | res, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(makeDoc(1000))) |
| 565 | if err != nil { |
| 566 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error at budget boundary: %s", err) |
| 567 | } |
| 568 | items, err := res.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("items") |
| 569 | if err != nil { |
| 570 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 571 | } |
| 572 | last, err := items.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(999) |
| 573 | if err != nil { |
| 574 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 575 | } |
| 576 | got, err := last.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 577 | if err != nil { |
| 578 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 579 | } |
| 580 | if got != "value" { |
| 581 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected value: %s", got) |
| 582 | } |
| 583 | |
| 584 | _, err = reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(makeDoc(1001))) |
| 585 | if err == nil { |
| 586 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected error, got nil") |
| 587 | } |
| 588 | 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, yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/.ErrYamlExpansionBudgetExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/ErrYamlExpansionBudgetExceeded.) { |
| 589 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err) |
| 590 | } |
| 591 | }) |
| 592 | |
| 593 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("double quoted string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 594 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `name: "Tom" |
| 595 | `, |
| 596 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 597 | |
| 598 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("single quoted string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 599 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `name: 'Tom' |
| 600 | `, |
| 601 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 602 | |
| 603 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("literal block scalar", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 604 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `bio: | |
| 605 | line1 |
| 606 | line2 |
| 607 | `, |
| 608 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 609 | |
| 610 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("folded block scalar", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 611 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `bio: > |
| 612 | line1 |
| 613 | line2 |
| 614 | `, |
| 615 | outscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#out.: "bio: >\n line1 line2\n\n", |
| 616 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 617 | |
| 618 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("mixed styles", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 619 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `plain: Tom |
| 620 | double: "Tom" |
| 621 | single: 'Tom' |
| 622 | `, |
| 623 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 624 | |
| 625 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("quoted timestamp string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 626 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `date: "2025-09-30T23:19:51Z" |
| 627 | `, |
| 628 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 629 | |
| 630 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("plain string unchanged", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 631 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `name: Tom |
| 632 | `, |
| 633 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 634 | |
| 635 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested map with quoted values", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 636 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `user: |
| 637 | name: "Tom" |
| 638 | nick: 'T' |
| 639 | `, |
| 640 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 641 | |
| 642 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("quoted bool string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 643 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `enabled: "true" |
| 644 | `, |
| 645 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 646 | |
| 647 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("single quoted bool string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 648 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `enabled: 'false' |
| 649 | `, |
| 650 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 651 | |
| 652 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("quoted int string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 653 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `port: "8080" |
| 654 | `, |
| 655 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 656 | |
| 657 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("quoted null string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 658 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `value: "null" |
| 659 | `, |
| 660 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 661 | |
| 662 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("quoted float string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 663 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `ratio: "1.5" |
| 664 | `, |
| 665 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 666 | |
| 667 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("quoted empty string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 668 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `name: "" |
| 669 | `, |
| 670 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 671 | |
| 672 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("single quoted empty string", rwTestCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#{ |
| 673 | inscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#in.: `name: '' |
| 674 | `, |
| 675 | }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml_test`/rwTestCase#run().) |
| 676 | |
| 677 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("yaml expansion budget resets per document", 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#) { |
| 678 | reader, err := parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#("yaml").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().()) |
| 679 | if err != nil { |
| 680 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 681 | } |
| 682 | |
| 683 | makeDoc := func(aliasCount int) string { |
| 684 | res := "root: &root value\nitems:\n" |
| 685 | for i := 0; i < aliasCount; i++ { |
| 686 | res += " - *root\n" |
| 687 | } |
| 688 | return res |
| 689 | } |
| 690 | |
| 691 | multiDoc := makeDoc(1000) + "---\n" + makeDoc(1000) |
| 692 | res, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.([]byte(multiDoc)) |
| 693 | if err != nil { |
| 694 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 695 | } |
| 696 | |
| 697 | first, err := res.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(0) |
| 698 | if err != nil { |
| 699 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 700 | } |
| 701 | second, err := res.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(1) |
| 702 | if err != nil { |
| 703 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 704 | } |
| 705 | for _, doc := range []*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#{first, second} { |
| 706 | items, err := doc.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("items") |
| 707 | if err != nil { |
| 708 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 709 | } |
| 710 | last, err := items.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(999) |
| 711 | if err != nil { |
| 712 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 713 | } |
| 714 | got, err := last.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 715 | if err != nil { |
| 716 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %s", err) |
| 717 | } |
| 718 | if got != "value" { |
| 719 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected value: %s", got) |
| 720 | } |
| 721 | } |
| 722 | }) |
| 723 | } |