From e4f8b873e19b2bb0f23950caa384e85af2f373ad Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Wed, 30 Dec 2020 16:27:49 +0100 Subject: [PATCH] Adjust to latest changes in go-yaml/yaml#684. --- stores/yaml/store_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/stores/yaml/store_test.go b/stores/yaml/store_test.go index 5e1af0e3e8..988380f013 100644 --- a/stores/yaml/store_test.go +++ b/stores/yaml/store_test.go @@ -84,7 +84,11 @@ prometheus-node-exporter: `) var COMMENT_4 = []byte(`# foo +`) +var COMMENT_5 = []byte(`# foo +--- +key: value `) func TestUnmarshalMetadataFromNonSOPSFile(t *testing.T) { @@ -139,6 +143,16 @@ func TestComment4(t *testing.T) { assert.Equal(t, COMMENT_4, bytes) } +func TestComment5(t *testing.T) { + // First iteration: load and store + branches, err := (&Store{}).LoadPlainFile(COMMENT_5) + assert.Nil(t, err) + bytes, err := (&Store{}).EmitPlainFile(branches) + assert.Nil(t, err) + assert.Equal(t, string(COMMENT_5), string(bytes)) + assert.Equal(t, COMMENT_5, bytes) +} + func TestEmpty(t *testing.T) { // First iteration: load and store branches, err := (&Store{}).LoadPlainFile([]byte(``))