| 1 | package ini_testscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "github.com/google/go-cmp/cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/" |
| 5 | "github.com/tomwright/dasel/v3/parsing/iniscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/" |
| 6 | "testingscip-go gomod github.com/golang/go/src go1.25 testing/" |
| 7 | |
| 8 | "github.com/tomwright/dasel/v3/parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/" |
| 9 | ) |
| 10 | |
| 11 | func TestIniscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini_test`/TestIni().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 12 | doc := []byte(`app_mode = development |
| 13 | |
| 14 | [paths] |
| 15 | data = /home/git/grafana |
| 16 | |
| 17 | [server] |
| 18 | protocol = http |
| 19 | http_port = 9999 |
| 20 | enforce_domain = true |
| 21 | |
| 22 | [profile testing] |
| 23 | something = foo |
| 24 | `) |
| 25 | reader, err := iniscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/.INIscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/INI..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().()) |
| 26 | if err != nil { |
| 27 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 28 | } |
| 29 | writer, err := iniscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/.INIscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/INI..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().()) |
| 30 | if err != nil { |
| 31 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 32 | } |
| 33 | |
| 34 | value, err := reader.Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#Read.(doc) |
| 35 | if err != nil { |
| 36 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 37 | } |
| 38 | |
| 39 | newDoc, err := writer.Writescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer#Write.(value) |
| 40 | if err != nil { |
| 41 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 42 | } |
| 43 | |
| 44 | if string(doc) != string(newDoc) { |
| 45 | 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))) |
| 46 | } |
| 47 | } |