From ad0608da27c11dd964418cce982dbcda0d0db8d3 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Sat, 7 Oct 2023 03:29:34 +0000 Subject: [PATCH] add test for spinner Signed-off-by: Billy Zha --- .../internal/display/progress/spinner_test.go | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 cmd/oras/internal/display/progress/spinner_test.go diff --git a/cmd/oras/internal/display/progress/spinner_test.go b/cmd/oras/internal/display/progress/spinner_test.go new file mode 100644 index 000000000..1a799b76d --- /dev/null +++ b/cmd/oras/internal/display/progress/spinner_test.go @@ -0,0 +1,30 @@ +/* +Copyright The ORAS 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 progress + +import "testing" + +func Test_spinner_symbol(t *testing.T) { + var s spinner + for i := 0; i < len(spinnerSymbols); i++ { + if s.symbol() != spinnerSymbols[i] { + t.Errorf("symbol() = %v, want %v", s.symbol(), spinnerSymbols[i]) + } + } + if s.symbol() != spinnerSymbols[0] { + t.Errorf("symbol() = %v, want %v", s.symbol(), spinnerSymbols[0]) + } +}