From b4033b2e4062862d0c669fd7203a04913bc4270a Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 9 Mar 2024 23:49:41 +0300 Subject: [PATCH] metadata: add exclude to Copy func Signed-off-by: Vasiliy Tolstov --- metadata/metadata_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/metadata/metadata_test.go b/metadata/metadata_test.go index eccea7a7..a5381ede 100644 --- a/metadata/metadata_test.go +++ b/metadata/metadata_test.go @@ -190,3 +190,14 @@ func TestMetadataContext(t *testing.T) { t.Errorf("Expected metadata length 1 got %d", i) } } + +func TestCopy(t *testing.T) { + md := New(2) + md.Set("key1", "val1", "key2", "val2") + nmd := Copy(md, "key2") + if len(nmd) != 1 { + t.Fatal("Copy exclude not works") + } else if nmd["Key1"] != "val1" { + t.Fatal("Copy exclude not works") + } +}