vendor: remove dep and use vndr
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
16f44674a4
commit
148e72d81e
16131 changed files with 73815 additions and 4235138 deletions
47
vendor/k8s.io/kubernetes/pkg/util/term/BUILD
generated
vendored
47
vendor/k8s.io/kubernetes/pkg/util/term/BUILD
generated
vendored
|
@ -1,47 +0,0 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
"go_test",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"resize.go",
|
||||
"resizeevents.go",
|
||||
"setsize.go",
|
||||
"term.go",
|
||||
"term_writer.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//pkg/util/interrupt:go_default_library",
|
||||
"//vendor:github.com/docker/docker/pkg/term",
|
||||
"//vendor:github.com/mitchellh/go-wordwrap",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/runtime",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["term_writer_test.go"],
|
||||
library = ":go_default_library",
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
98
vendor/k8s.io/kubernetes/pkg/util/term/term_writer_test.go
generated
vendored
98
vendor/k8s.io/kubernetes/pkg/util/term/term_writer_test.go
generated
vendored
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package term
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
const test = "Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube Kube"
|
||||
|
||||
func TestWordWrapWriter(t *testing.T) {
|
||||
testcases := map[string]struct {
|
||||
input string
|
||||
maxWidth uint
|
||||
}{
|
||||
"max 10": {input: test, maxWidth: 10},
|
||||
"max 80": {input: test, maxWidth: 80},
|
||||
"max 120": {input: test, maxWidth: 120},
|
||||
"max 5000": {input: test, maxWidth: 5000},
|
||||
}
|
||||
for k, tc := range testcases {
|
||||
b := bytes.NewBufferString("")
|
||||
w := NewWordWrapWriter(b, tc.maxWidth)
|
||||
_, err := w.Write([]byte(tc.input))
|
||||
if err != nil {
|
||||
t.Errorf("%s: Unexpected error: %v", k, err)
|
||||
}
|
||||
result := b.String()
|
||||
if !strings.Contains(result, "Kube") {
|
||||
t.Errorf("%s: Expected to contain \"Kube\"", k)
|
||||
}
|
||||
if len(result) < len(tc.input) {
|
||||
t.Errorf("%s: Unexpectedly short string, got %d wanted at least %d chars: %q", k, len(result), len(tc.input), result)
|
||||
}
|
||||
for _, line := range strings.Split(result, "\n") {
|
||||
if len(line) > int(tc.maxWidth) {
|
||||
t.Errorf("%s: Every line must be at most %d chars long, got %d: %q", k, tc.maxWidth, len(line), line)
|
||||
}
|
||||
}
|
||||
for _, word := range strings.Split(result, " ") {
|
||||
if !strings.Contains(word, "Kube") {
|
||||
t.Errorf("%s: Unexpected broken word: %q", k, word)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMaxWidthWriter(t *testing.T) {
|
||||
testcases := map[string]struct {
|
||||
input string
|
||||
maxWidth uint
|
||||
}{
|
||||
"max 10": {input: test, maxWidth: 10},
|
||||
"max 80": {input: test, maxWidth: 80},
|
||||
"max 120": {input: test, maxWidth: 120},
|
||||
"max 5000": {input: test, maxWidth: 5000},
|
||||
}
|
||||
for k, tc := range testcases {
|
||||
b := bytes.NewBufferString("")
|
||||
w := NewMaxWidthWriter(b, tc.maxWidth)
|
||||
_, err := w.Write([]byte(tc.input))
|
||||
if err != nil {
|
||||
t.Errorf("%s: Unexpected error: %v", k, err)
|
||||
}
|
||||
result := b.String()
|
||||
if !strings.Contains(result, "Kube") {
|
||||
t.Errorf("%s: Expected to contain \"Kube\"", k)
|
||||
}
|
||||
if len(result) < len(tc.input) {
|
||||
t.Errorf("%s: Unexpectedly short string, got %d wanted at least %d chars: %q", k, len(result), len(tc.input), result)
|
||||
}
|
||||
lines := strings.Split(result, "\n")
|
||||
for i, line := range lines {
|
||||
if len(line) > int(tc.maxWidth) {
|
||||
t.Errorf("%s: Every line must be at most %d chars long, got %d: %q", k, tc.maxWidth, len(line), line)
|
||||
}
|
||||
if i < len(lines)-1 && len(line) != int(tc.maxWidth) {
|
||||
t.Errorf("%s: Lines except the last one are expected to be exactly %d chars long, got %d: %q", k, tc.maxWidth, len(line), line)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue