| 486 | } |
| 487 | |
| 488 | func TestUnencryptedCommentRegex(t *testing.T) { |
| 489 | branches := TreeBranches{ |
| 490 | TreeBranch{ |
| 491 | TreeItem{ |
| 492 | Key: Comment{Value: "sops:noenc"}, |
| 493 | Value: nil, |
| 494 | }, |
| 495 | TreeItem{ |
| 496 | Key: "foo", |
| 497 | Value: "bar", |
| 498 | }, |
| 499 | TreeItem{ |
| 500 | Key: "bar", |
| 501 | Value: TreeBranch{ |
| 502 | TreeItem{ |
| 503 | Key: "foo", |
| 504 | Value: "bar", |
| 505 | }, |
| 506 | TreeItem{ |
| 507 | Key: Comment{Value: "before"}, |
| 508 | Value: nil, |
| 509 | }, |
| 510 | TreeItem{ |
| 511 | Key: Comment{Value: "sops:noenc"}, |
| 512 | Value: nil, |
| 513 | }, |
| 514 | TreeItem{ |
| 515 | Key: "notencrypted", |
| 516 | Value: "bar", |
| 517 | }, |
| 518 | }, |
| 519 | }, |
| 520 | TreeItem{ |
| 521 | Key: "array", |
| 522 | Value: []interface{}{ |
| 523 | "bar", |
| 524 | Comment{Value: "sops:noenc"}, |
| 525 | "baz", |
| 526 | }, |
| 527 | }, |
| 528 | TreeItem{ |
| 529 | Key: Comment{Value: "sops:noenc"}, |
| 530 | Value: nil, |
| 531 | }, |
| 532 | TreeItem{ |
| 533 | Key: Comment{Value: "after"}, |
| 534 | Value: nil, |
| 535 | }, |
| 536 | TreeItem{ |
| 537 | Key: "notencarray", |
| 538 | Value: []interface{}{ |
| 539 | "bar", |
| 540 | "baz", |
| 541 | }, |
| 542 | }, |
| 543 | }, |
| 544 | } |
| 545 | tree := Tree{Branches: branches, Metadata: Metadata{UnencryptedCommentRegex: "sops:noenc"}} |