Support lists of deeply marked values
This commit is contained in:
parent
3dde9efc75
commit
0b3c21a3eb
|
@ -26,8 +26,8 @@ func LongestCommonSubsequence(xs, ys []cty.Value) []cty.Value {
|
|||
|
||||
for y := 0; y < len(ys); y++ {
|
||||
for x := 0; x < len(xs); x++ {
|
||||
unmarkedX, xMarks := xs[x].Unmark()
|
||||
unmarkedY, yMarks := ys[y].Unmark()
|
||||
unmarkedX, xMarks := xs[x].UnmarkDeep()
|
||||
unmarkedY, yMarks := ys[y].UnmarkDeep()
|
||||
eqV := unmarkedX.Equals(unmarkedY)
|
||||
if len(xMarks) != len(yMarks) {
|
||||
eqV = cty.False
|
||||
|
|
|
@ -87,6 +87,21 @@ func TestLongestCommonSubsequence(t *testing.T) {
|
|||
[]cty.Value{cty.NumberIntVal(2)},
|
||||
[]cty.Value{},
|
||||
},
|
||||
{
|
||||
[]cty.Value{
|
||||
cty.MapVal(map[string]cty.Value{"a": cty.StringVal("x").Mark("sensitive")}),
|
||||
cty.MapVal(map[string]cty.Value{"b": cty.StringVal("y")}),
|
||||
},
|
||||
[]cty.Value{
|
||||
cty.MapVal(map[string]cty.Value{"a": cty.StringVal("x").Mark("sensitive")}),
|
||||
cty.MapVal(map[string]cty.Value{"b": cty.StringVal("y")}),
|
||||
cty.MapVal(map[string]cty.Value{"c": cty.StringVal("z")}),
|
||||
},
|
||||
[]cty.Value{
|
||||
cty.MapVal(map[string]cty.Value{"a": cty.StringVal("x").Mark("sensitive")}),
|
||||
cty.MapVal(map[string]cty.Value{"b": cty.StringVal("y")}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
|
Loading…
Reference in New Issue