Fix noinlineerr findings: internal/cli (refs #61)
This commit is contained in:
@@ -120,29 +120,35 @@ func TestYAMLPathSet(t *testing.T) {
|
||||
root := parseTestYAML(t)
|
||||
|
||||
// Overwrite existing nested value
|
||||
if err := yamlPathSet(root, splitPath("s3.bucket"), "newbucket"); err != nil {
|
||||
err := yamlPathSet(root, splitPath("s3.bucket"), "newbucket")
|
||||
if err != nil {
|
||||
t.Fatalf("set s3.bucket: %v", err)
|
||||
}
|
||||
|
||||
// Create new nested key with intermediate map
|
||||
if err := yamlPathSet(root, splitPath("s3.endpoint"), "s3.example.com"); err != nil {
|
||||
err = yamlPathSet(root, splitPath("s3.endpoint"), "s3.example.com")
|
||||
if err != nil {
|
||||
t.Fatalf("set s3.endpoint: %v", err)
|
||||
}
|
||||
|
||||
if err := yamlPathSet(root, splitPath("newmap.newkey"), "val"); err != nil {
|
||||
err = yamlPathSet(root, splitPath("newmap.newkey"), "val")
|
||||
if err != nil {
|
||||
t.Fatalf("set newmap.newkey: %v", err)
|
||||
}
|
||||
|
||||
// Overwrite a sequence element and append a new one
|
||||
if err := yamlPathSet(root, splitPath("age_recipients.0"), "age1bbb"); err != nil {
|
||||
err = yamlPathSet(root, splitPath("age_recipients.0"), "age1bbb")
|
||||
if err != nil {
|
||||
t.Fatalf("set age_recipients.0: %v", err)
|
||||
}
|
||||
|
||||
if err := yamlPathSet(root, splitPath("age_recipients.1"), "age1ccc"); err != nil {
|
||||
err = yamlPathSet(root, splitPath("age_recipients.1"), "age1ccc")
|
||||
if err != nil {
|
||||
t.Fatalf("append age_recipients.1: %v", err)
|
||||
}
|
||||
|
||||
if err := yamlPathSet(root, splitPath("age_recipients.5"), "age1ddd"); err == nil {
|
||||
err = yamlPathSet(root, splitPath("age_recipients.5"), "age1ddd")
|
||||
if err == nil {
|
||||
t.Error("expected out-of-range append to fail")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user