Skip to content

Commit 77b858b

Browse files
author
dmitriy kalinin
committed
looks like yaml.v2 is already fixed
1 parent 664cd67 commit 77b858b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

docs/go-yaml.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Tests: [patch/yaml_compat_test.go](../patch/yaml_compat_test.go)
44

5-
- Use `!!str ""` instead of `""`
5+
- [fixed] Use `!!str ""` instead of `""`

patch/yaml_compat_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
var _ = Describe("YAML compatibility", func() {
1212
Describe("empty string", func() {
13-
It("[WORKAROUND] works deserializing empty strings", func() {
13+
It("[workaround] works deserializing empty strings", func() {
1414
str := `
1515
- type: replace
1616
path: /instance_groups/name=cloud_controller/instances
@@ -26,7 +26,7 @@ var _ = Describe("YAML compatibility", func() {
2626
Expect((*val).(string)).To(Equal(""))
2727
})
2828

29-
It("[PORBLEM] does not work deserializing empty strings", func() {
29+
It("[fixed] does not work deserializing empty strings", func() {
3030
str := `
3131
- type: replace
3232
path: /instance_groups/name=cloud_controller/instances
@@ -36,8 +36,10 @@ var _ = Describe("YAML compatibility", func() {
3636
var opDefs []OpDefinition
3737

3838
err := yaml.Unmarshal([]byte(str), &opDefs)
39-
Expect(err).To(HaveOccurred())
40-
Expect(err.Error()).To(ContainSubstring("cannot unmarshal !!str"))
39+
Expect(err).ToNot(HaveOccurred())
40+
41+
val := opDefs[0].Value
42+
Expect((*val).(string)).To(Equal(""))
4143
})
4244
})
4345
})

0 commit comments

Comments
 (0)