Debian Codegraph @

model/value_test.go

raw symbols SCIP
1 package model_testscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/
2
3 import (
4 "stringsscip-go gomod github.com/golang/go/src go1.25 strings/"
5 "testingscip-go gomod github.com/golang/go/src go1.25 testing/"
6
7 "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/"
8 "github.com/tomwright/dasel/v3/model/orderedmapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/"
9 )
10
11 func TestType_Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestType_String().(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 run := func(ty modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Type#, exp string) func(*testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
13 return func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
14 got := ty.Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Type#String().()
15 if got != exp {
16 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected %s, got %s", exp, got)
17 }
18 }
19 }
20 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("string", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeStringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeString., "string"))
21 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("int", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeIntscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeInt., "int"))
22 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("float", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeFloatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeFloat., "float"))
23 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("bool", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeBoolscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeBool., "bool"))
24 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("map", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeMap., "map"))
25 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("slice", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeSlice., "array"))
26 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("unknown", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeUnknownscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeUnknown., "unknown"))
27 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("null", run(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., "null"))
28 }
29
30 func TestValue_Lenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_Len().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
31 run := func(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#, exp int) func(*testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
32 return func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
33 got, err := v.Lenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Len().()
34 if err != nil {
35 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("unexpected error: %s", err)
36 return
37 }
38 if got != exp {
39 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected %d, got %d", exp, got)
40 }
41 }
42 }
43 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("string", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
44 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("empty", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(""), 0))
45 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("non-empty", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello"), 5))
46 })
47 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("slice", 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#) {
48 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("empty", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().(), 0))
49 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("non-empty", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewValue().([]any{1, 2, 3}), 3))
50 })
51 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#) {
52 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("empty", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().(), 0))
53 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("non-empty", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewValue().(map[string]any{"one": 1, "two": 2, "three": 3}), 3))
54 })
55 }
56
57 func TestValue_IsScalarscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_IsScalar().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
58 run := func(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#, exp bool) func(*testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
59 return func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
60 got := v.IsScalarscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsScalar().()
61 if got != exp {
62 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected %v, got %v", exp, got)
63 }
64 }
65 }
66 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("string", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("foo"), true))
67 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("bool", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(true), true))
68 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("int", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1), true))
69 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("float", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(1.0), true))
70 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("null", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().(), true))
71 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("map", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().(), false))
72 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("slice", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().(), false))
73
74 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#) {
75 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested string", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("foo")), true))
76 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested bool", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(true)), true))
77 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested int", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1)), true))
78 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested float", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(1.0)), true))
79 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested null", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().()), true))
80 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested map", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()), false))
81 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("nested slice", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()), false))
82
83 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("double nested string", run(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("foo"))), true))
84 })
85 }
86
87 func TestErrorTypesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestErrorTypes().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
88 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("MapKeyNotFound", 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#) {
89 err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.MapKeyNotFoundscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/MapKeyNotFound#{Keyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/MapKeyNotFound#Key.: "foo"}
90 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(err.Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/MapKeyNotFound#Error().(), "foo") {
91 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected error to contain 'foo', got %s", err.Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/MapKeyNotFound#Error().())
92 }
93 })
94 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("SliceIndexOutOfRange", 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#) {
95 err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.SliceIndexOutOfRangescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/SliceIndexOutOfRange#{Indexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/SliceIndexOutOfRange#Index.: 5}
96 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(err.Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/SliceIndexOutOfRange#Error().(), "5") {
97 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected error to contain '5', got %s", err.Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/SliceIndexOutOfRange#Error().())
98 }
99 })
100 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("ErrIncompatibleTypes", 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#) {
101 err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.ErrIncompatibleTypesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrIncompatibleTypes#{
102 Ascip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrIncompatibleTypes#A.: modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello"),
103 Bscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrIncompatibleTypes#B.: modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(42),
104 }
105 msg := err.Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrIncompatibleTypes#Error().()
106 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(msg, "string") || !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(msg, "int") {
107 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected error to contain both types, got %s", msg)
108 }
109 })
110 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("ErrUnexpectedType", 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#) {
111 err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.ErrUnexpectedTypescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrUnexpectedType#{
112 Expectedscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrUnexpectedType#Expected.: modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeStringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeString.,
113 Actualscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrUnexpectedType#Actual.: modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeIntscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeInt.,
114 }
115 msg := err.Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrUnexpectedType#Error().()
116 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(msg, "string") || !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(msg, "int") {
117 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected error to contain expected and actual types, got %s", msg)
118 }
119 })
120 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("ErrUnexpectedTypes", 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#) {
121 err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.ErrUnexpectedTypesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrUnexpectedTypes#{
122 Expectedscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrUnexpectedTypes#Expected.: []modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Type#{modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeSlice., modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeMap.},
123 Actualscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrUnexpectedTypes#Actual.: modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeIntscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeInt.,
124 }
125 msg := err.Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrUnexpectedTypes#Error().()
126 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(msg, "array") || !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(msg, "map") || !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(msg, "int") {
127 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected error to contain expected list and actual, got %s", msg)
128 }
129 })
130 }
131
132 func TestErrCouldNotUnpackToTypescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestErrCouldNotUnpackToType().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
133 err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.ErrCouldNotUnpackToTypescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrCouldNotUnpackToType#{}
134 got := err.Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/ErrCouldNotUnpackToType#Error().()
135 if got == "" {
136 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected non-empty error message")
137 }
138 }
139
140 func TestValue_Len_Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_Len_Error().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
141 _, err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(42).Lenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Len().()
142 if err == nil {
143 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected error for Len on int")
144 }
145 }
146
147 func TestValue_Copyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_Copy().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
148 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("map copy is independent", 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#) {
149 orig := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewValue().(orderedmapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/.NewMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/NewMap().().Setscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/Map#Set().("a", "one"))
150 cp, err := orig.Copyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Copy().()
151 if err != nil {
152 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
153 }
154 // Modify original
155 if err := orig.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("a", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("modified")); err != nil {
156 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
157 }
158 // Copy should be unchanged
159 val, err := cp.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("a")
160 if err != nil {
161 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
162 }
163 got, err := val.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().()
164 if err != nil {
165 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
166 }
167 if got != "one" {
168 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected copy to be 'one', got %s", got)
169 }
170 })
171 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("non-map returns 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#) {
172 _, err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1).Copyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Copy().()
173 if err == nil {
174 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected error for Copy on non-map")
175 }
176 })
177 }
178
179 func TestValues_ToSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValues_ToSliceValue().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
180 vals := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Values#{modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1), modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello")}
181 sv, err := vals.ToSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Values#ToSliceValue().()
182 if err != nil {
183 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
184 }
185 l, err := sv.Lenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Len().()
186 if err != nil {
187 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
188 }
189 if l != 2 {
190 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected length 2, got %d", l)
191 }
192 }
193
194 func TestValue_Interfacescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_Interface().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
195 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("string", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
196 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello")
197 got := v.Interfacescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Interface().()
198 if got == nil {
199 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected non-nil interface")
200 }
201 })
202 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("int", 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#) {
203 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(42)
204 got := v.Interfacescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Interface().()
205 if got == nil {
206 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected non-nil interface")
207 }
208 })
209 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("null", 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#) {
210 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().()
211 got := v.Interfacescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Interface().()
212 if got != nil {
213 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected nil, got %v", got)
214 }
215 })
216 }
217
218 func TestValue_EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_EqualTypeValue().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
219 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("same 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#) {
220 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello")
221 b := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello")
222 eq, err := a.EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(b)
223 if err != nil {
224 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
225 }
226 if !eq {
227 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected equal")
228 }
229 })
230 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("different 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#) {
231 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello")
232 b := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("world")
233 eq, err := a.EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(b)
234 if err != nil {
235 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
236 }
237 if eq {
238 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected not equal")
239 }
240 })
241 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("different 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#) {
242 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("1")
243 b := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1)
244 eq, err := a.EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(b)
245 if err != nil {
246 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
247 }
248 if eq {
249 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected not equal for different types")
250 }
251 })
252 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("same 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#) {
253 eq, err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(42).EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(42))
254 if err != nil {
255 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
256 }
257 if !eq {
258 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected equal")
259 }
260 })
261 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("different 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#) {
262 eq, err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1).EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2))
263 if err != nil {
264 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
265 }
266 if eq {
267 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected not equal")
268 }
269 })
270 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("same floats", 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#) {
271 eq, err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(3.14).EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(3.14))
272 if err != nil {
273 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
274 }
275 if !eq {
276 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected equal")
277 }
278 })
279 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("same bools", 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#) {
280 eq, err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(true).EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(true))
281 if err != nil {
282 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
283 }
284 if !eq {
285 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected equal")
286 }
287 })
288 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("both null", 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#) {
289 eq, err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().().EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().())
290 if err != nil {
291 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
292 }
293 if !eq {
294 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected equal")
295 }
296 })
297 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("same slices", 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#) {
298 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
299 _ = a.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
300 b := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
301 _ = b.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
302 eq, err := a.EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(b)
303 if err != nil {
304 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
305 }
306 if !eq {
307 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected equal")
308 }
309 })
310 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("different length slices", 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#) {
311 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
312 _ = a.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
313 b := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
314 eq, err := a.EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(b)
315 if err != nil {
316 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
317 }
318 if eq {
319 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected not equal")
320 }
321 })
322 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("same maps", 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#) {
323 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
324 _ = a.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("k", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("v"))
325 b := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
326 _ = b.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("k", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("v"))
327 eq, err := a.EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(b)
328 if err != nil {
329 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
330 }
331 if !eq {
332 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected equal")
333 }
334 })
335 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("different maps", 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#) {
336 a := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
337 _ = a.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("k", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("v"))
338 b := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
339 _ = b.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("k", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("w"))
340 eq, err := a.EqualTypeValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#EqualTypeValue().(b)
341 if err != nil {
342 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
343 }
344 if eq {
345 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected not equal")
346 }
347 })
348 }
349
350 func TestValue_GoValue_AllTypesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_GoValue_AllTypes().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
351 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("string", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
352 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello")
353 got, err := v.GoValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GoValue().()
354 if err != nil {
355 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
356 }
357 if got != "hello" {
358 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected 'hello', got %v", got)
359 }
360 })
361 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("int", 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#) {
362 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(42)
363 got, err := v.GoValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GoValue().()
364 if err != nil {
365 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
366 }
367 if got != int64(42) {
368 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected 42, got %v", got)
369 }
370 })
371 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("float", 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#) {
372 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(3.14)
373 got, err := v.GoValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GoValue().()
374 if err != nil {
375 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
376 }
377 if got != 3.14 {
378 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected 3.14, got %v", got)
379 }
380 })
381 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("bool", 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#) {
382 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(true)
383 got, err := v.GoValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GoValue().()
384 if err != nil {
385 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
386 }
387 if got != true {
388 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected true, got %v", got)
389 }
390 })
391 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("null", 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#) {
392 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().()
393 got, err := v.GoValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GoValue().()
394 if err != nil {
395 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
396 }
397 if got != nil {
398 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected nil, got %v", got)
399 }
400 })
401 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#) {
402 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
403 _ = v.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().("key", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("val"))
404 got, err := v.GoValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GoValue().()
405 if err != nil {
406 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
407 }
408 m, ok := got.(map[string]any)
409 if !ok {
410 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected map, got %T", got)
411 }
412 if m["key"] != "val" {
413 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected 'val', got %v", m["key"])
414 }
415 })
416 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("slice", 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#) {
417 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
418 _ = v.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
419 _ = v.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2))
420 got, err := v.GoValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GoValue().()
421 if err != nil {
422 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
423 }
424 s, ok := got.([]any)
425 if !ok {
426 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected slice, got %T", got)
427 }
428 if len(s) != 2 {
429 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected length 2, got %d", len(s))
430 }
431 })
432 }
433
434 func TestValue_Set_SetFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_Set_SetFn().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
435 // When we get a map key, the returned value has a setFn that allows setting it back.
436 m := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewValue().(orderedmapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/.NewMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/NewMap().().Setscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/Map#Set().("key", "original"))
437 val, err := m.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("key")
438 if err != nil {
439 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
440 }
441 if err := val.Setscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Set().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("modified")); err != nil {
442 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
443 }
444 // Verify the map was updated
445 updated, err := m.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().("key")
446 if err != nil {
447 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
448 }
449 got, err := updated.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().()
450 if err != nil {
451 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
452 }
453 if got != "modified" {
454 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected 'modified', got %s", got)
455 }
456 }
457
458 func TestValue_Set_Nestedscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_Set_Nested().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
459 // Test setting a value via a nested dasel value (exercises the isDaselValue branch in Set)
460 inner := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("original")
461 outer := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNestedValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNestedValue().(inner)
462 if err := outer.Setscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Set().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("updated")); err != nil {
463 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
464 }
465 }
466
467 func TestValue_Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_Kind().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
468 // Exercise the Kind method
469 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello")
470 k := v.Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Kind().()
471 if k.Stringscip-go gomod github.com/golang/go/src go1.25 reflect/Kind#String().() == "" {
472 t.Errorscip-go gomod github.com/golang/go/src go1.25 testing/common#Error().("expected non-empty kind")
473 }
474 }
475
476 func TestValue_Type_AllTypesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_Type_AllTypes().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
477 tests := []struct {
478 name string
479 val *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#
480 typ modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Type#
481 }{
482 {"string", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello"), modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeStringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeString.},
483 {"int", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1), modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeIntscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeInt.},
484 {"float", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(1.0), modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeFloatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeFloat.},
485 {"bool", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(true), modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeBoolscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeBool.},
486 {"map", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().(), modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeMap.},
487 {"slice", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().(), modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.TypeSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/TypeSlice.},
488 {"null", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().(), 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.},
489 }
490 for _, tt := range tests {
491 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().(tt.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#) {
492 if got := tt.val.Typescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Type().(); got != tt.typ {
493 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected %s, got %s", tt.typ, got)
494 }
495 })
496 }
497 }
498
499 func TestValue_MapLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_MapLen().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
500 m := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewValue().(orderedmapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/.NewMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/NewMap().().Setscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/Map#Set().("a", 1).Setscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/Map#Set().("b", 2).Setscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/Map#Set().("c", 3))
501 l, err := m.MapLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MapLen().()
502 if err != nil {
503 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
504 }
505 if l != 3 {
506 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected 3, got %d", l)
507 }
508 }
509
510 func TestValue_SliceLen_Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_SliceLen_Error().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
511 _, err := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(42).SliceLenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SliceLen().()
512 if err == nil {
513 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected error for SliceLen on int")
514 }
515 }
516
517 func TestValue_SetSliceIndex_Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_SetSliceIndex_Error().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
518 s := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
519 _ = s.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
520 err := s.SetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetSliceIndex().(5, modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2))
521 if err == nil {
522 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().("expected error for out of range SetSliceIndex")
523 }
524 }
525
526 func TestValue_Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_String().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
527 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("string", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
528 got := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello").Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#String().()
529 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(got, "hello") {
530 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected output to contain 'hello', got %s", got)
531 }
532 })
533 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("int", 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#) {
534 got := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(42).Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#String().()
535 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(got, "42") {
536 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected output to contain '42', got %s", got)
537 }
538 })
539 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("float", 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#) {
540 got := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(3.14).Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#String().()
541 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(got, "3.14") {
542 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected output to contain '3.14', got %s", got)
543 }
544 })
545 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("bool", 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#) {
546 got := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(true).Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#String().()
547 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(got, "true") {
548 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected output to contain 'true', got %s", got)
549 }
550 })
551 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("null", 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 got := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().().Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#String().()
553 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(got, "null") {
554 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected output to contain 'null', got %s", got)
555 }
556 })
557 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("slice", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
558 s := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
559 _ = s.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1))
560 got := s.Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#String().()
561 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(got, "array") {
562 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected output to contain 'array', got %s", got)
563 }
564 })
565 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#) {
566 m := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewValue().(orderedmapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/.NewMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/NewMap().().Setscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model/orderedmap`/Map#Set().("key", "val"))
567 got := m.Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#String().()
568 if !stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Containsscip-go gomod github.com/golang/go/src go1.25 strings/Contains().(got, "key") {
569 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected output to contain 'key', got %s", got)
570 }
571 })
572 }