Debian Codegraph @

cty/marks_test.go

raw symbols SCIP
1 package ctyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/
2
3 import (
4 "fmtscip-go gomod github.com/golang/go/src go1.18 fmt/"
5 "testingscip-go gomod github.com/golang/go/src go1.18 testing/"
6 )
7
8 func TestContainsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TestContainsMarked().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
9 testCases := []struct {
10 val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#
11 want bool
12 }{
13 {
14 StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("a"),
15 false,
16 },
17 {
18 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"),
19 true,
20 },
21 {
22 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
23 false,
24 },
25 {
26 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a")}),
27 true,
28 },
29 {
30 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"),
31 true,
32 },
33 {
34 ListValEmptyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListValEmpty().(Stringscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/String.).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("c"),
35 true,
36 },
37 {
38 MapValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/MapVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{"a": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("b").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("c"), "x": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("z")}),
39 true,
40 },
41 {
42 TupleValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TupleVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("z")}),
43 true,
44 },
45 {
46 SetValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/SetVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("z")}),
47 true,
48 },
49 {
50 ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
51 "x": ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
52 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"),
53 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2),
54 }),
55 "y": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y"),
56 "z": BoolValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/BoolVal().(true),
57 }),
58 true,
59 },
60 }
61
62 for _, tc := range testCases {
63 if got, want := tc.val.ContainsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ContainsMarked().(), tc.want; got != want {
64 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong result (got %v, want %v) for %#v", got, want, tc.val)
65 }
66 }
67 }
68
69 func TestIsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TestIsMarked().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
70 testCases := []struct {
71 val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#
72 want bool
73 }{
74 {
75 StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("a"),
76 false,
77 },
78 {
79 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"),
80 true,
81 },
82 {
83 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
84 false,
85 },
86 {
87 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a")}),
88 false,
89 },
90 {
91 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"),
92 true,
93 },
94 }
95
96 for _, tc := range testCases {
97 if got, want := tc.val.IsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#IsMarked().(), tc.want; got != want {
98 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong result (got %v, want %v) for %#v", got, want, tc.val)
99 }
100 }
101 }
102
103 func TestValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TestValueMarks().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
104 v := Truescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/True.
105 v1 := v.Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().(1)
106 v2 := v.Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().(2)
107
108 if got, want := v.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(); !want.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(got) {
109 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong v marks\ngot: %#v\nwant: %#v", got, want)
110 }
111 if got, want := v1.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(1); !want.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(got) {
112 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong v1 marks\ngot: %#v\nwant: %#v", got, want)
113 }
114 if got, want := v2.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(2); !want.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(got) {
115 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong v2 marks\ngot: %#v\nwant: %#v", got, want)
116 }
117
118 v12 := Falsescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/False..WithSameMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithSameMarks().(v, v1, v2)
119 if got, want := v12.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(1, 2); !want.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(got) {
120 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong v12 marks\ngot: %#v\nwant: %#v", got, want)
121 }
122
123 v12Again := v12.Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().(1)
124 if got, want := v12Again.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(1, 2); !want.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(got) {
125 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong v12Again marks\ngot: %#v\nwant: %#v", got, want)
126 }
127
128 v1234 := v12.WithMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithMarks().(NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(2, 3, 4))
129 if got, want := v1234.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(1, 2, 3, 4); !want.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(got) {
130 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong v1234 marks\ngot: %#v\nwant: %#v", got, want)
131 }
132 if !v1234.HasMarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#HasMark().(2) {
133 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("v1234 should have mark 2")
134 }
135 if v1234.HasMarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#HasMark().(5) {
136 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("v1234 should not have mark 5")
137 }
138
139 v, marks1234 := v1234.Unmarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Unmark().()
140 if got, want := v.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(); !want.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(got) {
141 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong v marks after unmarking\ngot: %#v\nwant: %#v", got, want)
142 }
143 if got, want := marks1234, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(1, 2, 3, 4); !want.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(got) {
144 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong marks1234\ngot: %#v\nwant: %#v", got, want)
145 }
146 if got, want := v, Falsescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/False.; !want.RawEqualsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#RawEquals().(got) {
147 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong v after unmarking\ngot: %#v\nwant: %#v", got, want)
148 }
149
150 // One more test for a more interesting/realistic situation involving
151 // a number of different operations.
152 a := NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a")
153 b := NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(5).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("b")
154 c := NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("c")
155 d := NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(12).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("d")
156 result := a.Multiplyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Multiply().(b).Subtractscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Subtract().(c).GreaterThanOrEqualToscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#GreaterThanOrEqualTo().(d)
157 if got, want := result, Falsescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/False..WithMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithMarks().(NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a", "b", "c", "d")); !want.RawEqualsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#RawEquals().(got) {
158 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong result\ngot: %#v\nwant: %#v", got, want)
159 }
160
161 // Unmark the result and capture the paths
162 unmarkedResult, pvm := result.UnmarkDeepWithPathsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#UnmarkDeepWithPaths().()
163 // Remark the result with those paths
164 remarked := unmarkedResult.MarkWithPathsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#MarkWithPaths().(pvm)
165 if got, want := remarked, Falsescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/False..WithMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithMarks().(NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a", "b", "c", "d")); !want.RawEqualsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#RawEquals().(got) {
166 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong result\ngot: %#v\nwant: %#v", got, want)
167 }
168
169 // If we call MarkWithPaths without any matching paths, we should get the unmarked result
170 markedWithNoPaths := unmarkedResult.MarkWithPathsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#MarkWithPaths().([]PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(0)}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("z")}})
171 if got, want := markedWithNoPaths, Falsescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/False.; !want.RawEqualsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#RawEquals().(got) {
172 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong result\ngot: %#v\nwant: %#v", got, want)
173 }
174 }
175
176 func TestPathValueMarksEqualscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TestPathValueMarksEqual().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
177 tests := []struct {
178 original PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#
179 compare PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#
180 want bool
181 }{
182 {
183 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(0)}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
184 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(0)}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
185 true,
186 },
187 {
188 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("p")}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(123)},
189 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("p")}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(123)},
190 true,
191 },
192 {
193 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(0)}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
194 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1)}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
195 false,
196 },
197 {
198 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(0)}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
199 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(0)}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("b")},
200 false,
201 },
202 {
203 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(0)}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
204 PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{IndexStepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#{Keyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStep#Key.: NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1)}}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("b")},
205 false,
206 },
207 }
208 for _, test := range tests {
209 t.Runscip-go gomod github.com/golang/go/src go1.18 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.18 fmt/Sprintf().("Comparing %#v to %#v", test.original, test.compare), func(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
210 got := test.original.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Equal().(test.compare)
211 if got != test.want {
212 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong result\ngot: %v\nwant: %v", got, test.want)
213 }
214 })
215 }
216 }
217
218 func TestMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TestMarks().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
219 wantMarks := func(marks ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#, expected ...string) {
220 if len(marks) != len(expected) {
221 t.Fatalfscip-go gomod github.com/golang/go/src go1.18 testing/common#Fatalf().("wrong marks: %#v", marks)
222 }
223 for _, mark := range expected {
224 if _, ok := marks[mark]; !ok {
225 t.Fatalfscip-go gomod github.com/golang/go/src go1.18 testing/common#Fatalf().("missing mark %q: %#v", mark, marks)
226 }
227 }
228 }
229
230 // Single mark
231 val := StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("foo").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a")
232 wantMarks(val.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), "a")
233 val, marks := val.Unmarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Unmark().()
234 if val.IsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#IsMarked().() {
235 t.Fatalfscip-go gomod github.com/golang/go/src go1.18 testing/common#Fatalf().("still marked after unmark: %#v", marks)
236 }
237 wantMarks(marks, "a")
238
239 // Multiple marks
240 val = val.WithMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithMarks().(NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a", "b", "c"))
241 wantMarks(val.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), "a", "b", "c")
242 val, marks = val.Unmarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Unmark().()
243 if val.IsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#IsMarked().() {
244 t.Fatalfscip-go gomod github.com/golang/go/src go1.18 testing/common#Fatalf().("still marked after unmark: %#v", marks)
245 }
246 wantMarks(marks, "a", "b", "c")
247
248 // Multiple marks, applied separately
249 val = val.Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("b")
250 wantMarks(val.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().(), "a", "b")
251 val, marks = val.Unmarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Unmark().()
252 if val.IsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#IsMarked().() {
253 t.Fatalfscip-go gomod github.com/golang/go/src go1.18 testing/common#Fatalf().("still marked after unmark: %#v", marks)
254 }
255 wantMarks(marks, "a", "b")
256 }
257
258 func TestUnmarkDeepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TestUnmarkDeep().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
259 testCases := map[string]struct {
260 val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#
261 want Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#
262 marks ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#
263 }{
264 "unmarked string": {
265 StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("a"),
266 StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("a"),
267 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(),
268 },
269 "marked number": {
270 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"),
271 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1),
272 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a"),
273 },
274 "unmarked list": {
275 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
276 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
277 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(),
278 },
279 "list with some elements marked": {
280 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
281 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
282 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a"),
283 },
284 "marked list with all elements marked": {
285 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("b")}).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("c"),
286 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
287 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a", "b", "c"),
288 },
289 "marked empty list": {
290 ListValEmptyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListValEmpty().(Stringscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/String.).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("c"),
291 ListValEmptyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListValEmpty().(Stringscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/String.),
292 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("c"),
293 },
294 "map with elements marked": {
295 MapValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/MapVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{"a": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("b").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("c"), "x": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("z")}),
296 MapValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/MapVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{"a": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("b"), "x": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y")}),
297 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("c", "z"),
298 },
299 "tuple with elements marked": {
300 TupleValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TupleVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("z")}),
301 TupleValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TupleVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y")}),
302 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a", "z"),
303 },
304 "set with elements marked": {
305 SetValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/SetVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("z")}),
306 SetValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/SetVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
307 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a", "z"),
308 },
309 "complex marked object with lots of marks": {
310 ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
311 "x": ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
312 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(3).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"),
313 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(5).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("b"),
314 }).WithMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithMarks().(NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("c", "d")),
315 "y": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("e"),
316 "z": BoolValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/BoolVal().(true).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("f"),
317 }).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("g"),
318 ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
319 "x": ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
320 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(3),
321 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(5),
322 }),
323 "y": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y"),
324 "z": BoolValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/BoolVal().(true),
325 }),
326 NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a", "b", "c", "d", "e", "f", "g"),
327 },
328 }
329
330 for name, tc := range testCases {
331 t.Runscip-go gomod github.com/golang/go/src go1.18 testing/T#Run().(name, func(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
332 got, marks := tc.val.UnmarkDeepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#UnmarkDeep().()
333 if !got.RawEqualsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#RawEquals().(tc.want) {
334 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong value\n got: %#v\nwant: %#v", got, tc.want)
335 }
336 if !marks.Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(tc.marks) {
337 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong marks\n got: %#v\nwant: %#v", got, tc.want)
338 }
339 })
340 }
341 }
342
343 func TestPathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TestPathValueMarks().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
344 testCases := map[string]struct {
345 marked Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#
346 unmarked Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#
347 pvms []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#
348 }{
349 "unmarked string": {
350 StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("a"),
351 StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("a"),
352 nil,
353 },
354 "marked number": {
355 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"),
356 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1),
357 []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{
358 {Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
359 },
360 },
361 "list with some elements marked": {
362 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
363 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
364 []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{
365 {IndexIntPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexIntPath().(0), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
366 },
367 },
368 "marked list with all elements marked": {
369 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("b")}).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("c"),
370 ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
371 []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{
372 {Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("c")},
373 {IndexIntPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexIntPath().(0), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
374 {IndexIntPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexIntPath().(1), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("b")},
375 },
376 },
377 "marked empty list": {
378 ListValEmptyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListValEmpty().(Stringscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/String.).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("c"),
379 ListValEmptyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListValEmpty().(Stringscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/String.),
380 []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{
381 {Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("c")},
382 },
383 },
384 "map with elements marked": {
385 MapValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/MapVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{"a": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("b").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("c"), "x": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("z")}),
386 MapValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/MapVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{"a": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("b"), "x": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y")}),
387 []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{
388 {IndexStringPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStringPath().("a"), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("c")},
389 {IndexStringPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexStringPath().("x"), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("z")},
390 },
391 },
392 "tuple with elements marked": {
393 TupleValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TupleVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("z"), ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{"x": Truescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/True.}).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("o")}),
394 TupleValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TupleVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y"), ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{"x": Truescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/True.})}),
395 []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{
396 {IndexIntPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexIntPath().(0), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
397 {IndexIntPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexIntPath().(1), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("z")},
398 {IndexIntPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/IndexIntPath().(2), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("o")},
399 },
400 },
401 "set with elements marked": {
402 SetValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/SetVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("z")}),
403 SetValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/SetVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(1), NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(2)}),
404 []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{
405 {Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a", "z")},
406 },
407 },
408 "complex marked object with lots of marks": {
409 ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
410 "x": ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
411 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(3).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("a"),
412 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(5).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("b"),
413 }).WithMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithMarks().(NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("c", "d")),
414 "y": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("e"),
415 "z": BoolValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/BoolVal().(true).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("f"),
416 }).Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("g"),
417 ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
418 "x": ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
419 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(3),
420 NumberIntValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NumberIntVal().(5),
421 }),
422 "y": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("y"),
423 "z": BoolValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/BoolVal().(true),
424 }),
425 []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{
426 {Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#{}, NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("g")},
427 {GetAttrPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/GetAttrPath().("x"), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("c", "d")},
428 {GetAttrPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/GetAttrPath().("x").IndexIntscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#IndexInt().(0), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("a")},
429 {GetAttrPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/GetAttrPath().("x").IndexIntscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#IndexInt().(1), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("b")},
430 {GetAttrPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/GetAttrPath().("y"), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("e")},
431 {GetAttrPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/GetAttrPath().("z"), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("f")},
432 },
433 },
434 "path array reuse regression test": {
435 ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
436 "environment": ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
437 ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
438 "variables": MapValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/MapVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
439 "bar": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("secret").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("sensitive"),
440 "foo": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("secret").Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().("sensitive"),
441 }),
442 }),
443 }),
444 }),
445 ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
446 "environment": ListValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ListVal().([]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
447 ObjectValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ObjectVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
448 "variables": MapValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/MapVal().(map[string]Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
449 "bar": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("secret"),
450 "foo": StringValscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/StringVal().("secret"),
451 }),
452 }),
453 }),
454 }),
455 []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{
456 {GetAttrPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/GetAttrPath().("environment").IndexIntscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#IndexInt().(0).GetAttrscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#GetAttr().("variables").IndexStringscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#IndexString().("bar"), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("sensitive")},
457 {GetAttrPathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/GetAttrPath().("environment").IndexIntscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#IndexInt().(0).GetAttrscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#GetAttr().("variables").IndexStringscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#IndexString().("foo"), NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().("sensitive")},
458 },
459 },
460 }
461
462 for name, tc := range testCases {
463 t.Runscip-go gomod github.com/golang/go/src go1.18 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.18 fmt/Sprintf().("unmark: %s", name), func(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
464 got, pvms := tc.marked.UnmarkDeepWithPathsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#UnmarkDeepWithPaths().()
465 if !got.RawEqualsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#RawEquals().(tc.unmarked) {
466 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong value\n got: %#v\nwant: %#v", got, tc.unmarked)
467 }
468
469 if len(pvms) != len(tc.pvms) {
470 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong length\n got: %d\nwant: %d", len(pvms), len(tc.pvms))
471 }
472
473 findPvm:
474 for _, wantPvm := range tc.pvms {
475 for _, gotPvm := range pvms {
476 if gotPvm.Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Path..Equalsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#Equals().(wantPvm.Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Path.) && gotPvm.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Marks..Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(wantPvm.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Marks.) {
477 continue findPvm
478 }
479 }
480 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("missing %#v\nnot found in: %#v", wantPvm, pvms)
481 }
482 })
483
484 t.Runscip-go gomod github.com/golang/go/src go1.18 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.18 fmt/Sprintf().("mark: %s", name), func(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
485 got := tc.unmarked.MarkWithPathsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#MarkWithPaths().(tc.pvms)
486 if !got.RawEqualsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#RawEquals().(tc.marked) {
487 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("wrong value\n got: %#v\nwant: %#v", got, tc.marked)
488 }
489 })
490 }
491 }