-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(encoding): fix failing tests due to the yaml library update
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
- Loading branch information
1 parent
f8a13cf
commit 98c10c3
Showing
6 changed files
with
343 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
//go:build !viper_yaml3 | ||
// +build !viper_yaml3 | ||
|
||
package yaml | ||
|
||
// original form of the data | ||
const original = `# key-value pair | ||
key: value | ||
list: | ||
- item1 | ||
- item2 | ||
- item3 | ||
map: | ||
key: value | ||
# nested | ||
# map | ||
nested_map: | ||
map: | ||
key: value | ||
list: | ||
- item1 | ||
- item2 | ||
- item3 | ||
` | ||
|
||
// encoded form of the data | ||
const encoded = `key: value | ||
list: | ||
- item1 | ||
- item2 | ||
- item3 | ||
map: | ||
key: value | ||
nested_map: | ||
map: | ||
key: value | ||
list: | ||
- item1 | ||
- item2 | ||
- item3 | ||
` | ||
|
||
// decoded form of the data | ||
// | ||
// in case of YAML it's slightly different from Viper's internal representation | ||
// (eg. map is decoded into a map with interface key) | ||
var decoded = map[string]interface{}{ | ||
"key": "value", | ||
"list": []interface{}{ | ||
"item1", | ||
"item2", | ||
"item3", | ||
}, | ||
"map": map[interface{}]interface{}{ | ||
"key": "value", | ||
}, | ||
"nested_map": map[interface{}]interface{}{ | ||
"map": map[interface{}]interface{}{ | ||
"key": "value", | ||
"list": []interface{}{ | ||
"item1", | ||
"item2", | ||
"item3", | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
// Viper's internal representation | ||
var data = map[string]interface{}{ | ||
"key": "value", | ||
"list": []interface{}{ | ||
"item1", | ||
"item2", | ||
"item3", | ||
}, | ||
"map": map[string]interface{}{ | ||
"key": "value", | ||
}, | ||
"nested_map": map[string]interface{}{ | ||
"map": map[string]interface{}{ | ||
"key": "value", | ||
"list": []interface{}{ | ||
"item1", | ||
"item2", | ||
"item3", | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
//go:build viper_yaml3 | ||
// +build viper_yaml3 | ||
|
||
package yaml | ||
|
||
// original form of the data | ||
const original = `# key-value pair | ||
key: value | ||
list: | ||
- item1 | ||
- item2 | ||
- item3 | ||
map: | ||
key: value | ||
# nested | ||
# map | ||
nested_map: | ||
map: | ||
key: value | ||
list: | ||
- item1 | ||
- item2 | ||
- item3 | ||
` | ||
|
||
// encoded form of the data | ||
const encoded = `key: value | ||
list: | ||
- item1 | ||
- item2 | ||
- item3 | ||
map: | ||
key: value | ||
nested_map: | ||
map: | ||
key: value | ||
list: | ||
- item1 | ||
- item2 | ||
- item3 | ||
` | ||
|
||
// decoded form of the data | ||
// | ||
// in case of YAML it's slightly different from Viper's internal representation | ||
// (eg. map is decoded into a map with interface key) | ||
var decoded = map[string]interface{}{ | ||
"key": "value", | ||
"list": []interface{}{ | ||
"item1", | ||
"item2", | ||
"item3", | ||
}, | ||
"map": map[string]interface{}{ | ||
"key": "value", | ||
}, | ||
"nested_map": map[string]interface{}{ | ||
"map": map[string]interface{}{ | ||
"key": "value", | ||
"list": []interface{}{ | ||
"item1", | ||
"item2", | ||
"item3", | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
// Viper's internal representation | ||
var data = map[string]interface{}{ | ||
"key": "value", | ||
"list": []interface{}{ | ||
"item1", | ||
"item2", | ||
"item3", | ||
}, | ||
"map": map[string]interface{}{ | ||
"key": "value", | ||
}, | ||
"nested_map": map[string]interface{}{ | ||
"map": map[string]interface{}{ | ||
"key": "value", | ||
"list": []interface{}{ | ||
"item1", | ||
"item2", | ||
"item3", | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.