mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 16:42:51 +00:00
36 lines
587 B
Go
36 lines
587 B
Go
// Copyright 2022 The Kubernetes Authors.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package edit
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestUpstairs(t *testing.T) {
|
|
var testCases = map[string]struct {
|
|
depth int
|
|
expected string
|
|
}{
|
|
"zero": {
|
|
depth: 0,
|
|
expected: "",
|
|
},
|
|
"one": {
|
|
depth: 1,
|
|
expected: "../",
|
|
},
|
|
"five": {
|
|
depth: 5,
|
|
expected: "../../../../../",
|
|
},
|
|
}
|
|
for n, tc := range testCases {
|
|
if tc.expected != upstairs(tc.depth) {
|
|
t.Fatalf(
|
|
"%s: for depth %d, expected %q, got %q",
|
|
n, tc.depth, tc.expected, upstairs(tc.depth))
|
|
}
|
|
}
|
|
}
|