With this patch it is possible to alias an existing allowed command. At the moment only builder allows an alias. This also properly puts the build command under builder, instead of image where it was for historical reasons. Signed-off-by: Tibor Vass <tibor@docker.com>
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package command
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gotest.tools/assert"
|
|
)
|
|
|
|
func TestStringSliceReplaceAt(t *testing.T) {
|
|
out, ok := StringSliceReplaceAt([]string{"abc", "foo", "bar", "bax"}, []string{"foo", "bar"}, []string{"baz"}, -1)
|
|
assert.Assert(t, ok)
|
|
assert.DeepEqual(t, []string{"abc", "baz", "bax"}, out)
|
|
|
|
out, ok = StringSliceReplaceAt([]string{"foo"}, []string{"foo", "bar"}, []string{"baz"}, -1)
|
|
assert.Assert(t, !ok)
|
|
assert.DeepEqual(t, []string{"foo"}, out)
|
|
|
|
out, ok = StringSliceReplaceAt([]string{"abc", "foo", "bar", "bax"}, []string{"foo", "bar"}, []string{"baz"}, 0)
|
|
assert.Assert(t, !ok)
|
|
assert.DeepEqual(t, []string{"abc", "foo", "bar", "bax"}, out)
|
|
|
|
out, ok = StringSliceReplaceAt([]string{"foo", "bar", "bax"}, []string{"foo", "bar"}, []string{"baz"}, 0)
|
|
assert.Assert(t, ok)
|
|
assert.DeepEqual(t, []string{"baz", "bax"}, out)
|
|
|
|
out, ok = StringSliceReplaceAt([]string{"abc", "foo", "bar", "baz"}, []string{"foo", "bar"}, nil, -1)
|
|
assert.Assert(t, ok)
|
|
assert.DeepEqual(t, []string{"abc", "baz"}, out)
|
|
|
|
out, ok = StringSliceReplaceAt([]string{"foo"}, nil, []string{"baz"}, -1)
|
|
assert.Assert(t, !ok)
|
|
assert.DeepEqual(t, []string{"foo"}, out)
|
|
}
|