From 955fc04dacd95c23c32f9a38a4622f9fbd717ab8 Mon Sep 17 00:00:00 2001 From: Paulin Todev Date: Thu, 31 Oct 2024 19:29:45 +0000 Subject: [PATCH] Delete incorrect comment --- docs/sources/reference/stdlib/targets.md | 3 --- syntax/vm/vm_stdlib_test.go | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/sources/reference/stdlib/targets.md b/docs/sources/reference/stdlib/targets.md index 131030d5d1..2f09a891c9 100644 --- a/docs/sources/reference/stdlib/targets.md +++ b/docs/sources/reference/stdlib/targets.md @@ -23,9 +23,6 @@ It takes three inputs: * The first two inputs are a of type `list(map(string))`. The keys of the map are strings. The value for each key could have any Alloy type such as a string, integer, map, or a capsule. * The third input is an array containing strings. The strings are the keys whose value has to match for maps to be joined. - - -If the set of keys don't identify a map uniquely, the resulting output may contain more maps than the total sum of maps from both input arrays. ### Examples diff --git a/syntax/vm/vm_stdlib_test.go b/syntax/vm/vm_stdlib_test.go index 04802fbad2..74a0ec771c 100644 --- a/syntax/vm/vm_stdlib_test.go +++ b/syntax/vm/vm_stdlib_test.go @@ -53,6 +53,12 @@ func TestVM_Stdlib(t *testing.T) { `targets.merge([{"a" = "a1", "b" = "b1"}, {"a" = "a1", "b" = "b1"}], [{"a" = "a1", "c" = "c1"}], ["a"])`, []map[string]interface{}{{"a": "a1", "b": "b1", "c": "c1"}, {"a": "a1", "b": "b1", "c": "c1"}}, }, + { + // Non-unique merge criteria. + "targets.merge", + `targets.merge([{"pod" = "a", "lbl" = "q"}, {"pod" = "b", "lbl" = "q"}], [{"pod" = "c", "lbl" = "q"}, {"pod" = "d", "lbl" = "q"}], ["lbl"])`, + []map[string]interface{}{{"lbl": "q", "pod": "c"}, {"lbl": "q", "pod": "d"}, {"lbl": "q", "pod": "c"}, {"lbl": "q", "pod": "d"}}, + }, { // Basic case. Integer and string values. "targets.merge",