MCPcopy
hub / github.com/getsops/sops / TestUnsetKeyInArrayItem

Function TestUnsetKeyInArrayItem

sops_test.go:1376–1409  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1374}
1375
1376func TestUnsetKeyInArrayItem(t *testing.T) {
1377 branch := TreeBranch{
1378 TreeItem{
1379 Key: "foo",
1380 Value: []interface{}{
1381 TreeBranch{
1382 TreeItem{
1383 Key: "bar",
1384 Value: "bar",
1385 },
1386 TreeItem{
1387 Key: "barbar",
1388 Value: "barbar",
1389 },
1390 },
1391 },
1392 },
1393 }
1394 unset, err := branch.Unset([]interface{}{"foo", 0, "barbar"})
1395 assert.NoError(t, err)
1396 assert.Equal(t, TreeBranch{
1397 TreeItem{
1398 Key: "foo",
1399 Value: []interface{}{
1400 TreeBranch{
1401 TreeItem{
1402 Key: "bar",
1403 Value: "bar",
1404 },
1405 },
1406 },
1407 },
1408 }, unset)
1409}
1410
1411func TestUnsetArrayLastItem(t *testing.T) {
1412 branch := TreeBranch{

Callers

nothing calls this directly

Calls 1

UnsetMethod · 0.95

Tested by

no test coverage detected