github.com/openshift-online/ocm-sdk-go@v0.1.473/logging/list_test.go (about)

     1  /*
     2  Copyright (c) 2021 Red Hat, Inc.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8    http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package logging
    18  
    19  import (
    20  	. "github.com/onsi/ginkgo/v2/dsl/core"  // nolint
    21  	. "github.com/onsi/ginkgo/v2/dsl/table" // nolint
    22  	. "github.com/onsi/gomega"              // nolint
    23  )
    24  
    25  var _ = Describe("List", func() {
    26  	Describe("All", func() {
    27  		DescribeTable("Examples",
    28  			func(items []string, list string) {
    29  				Expect(All(items)).To(Equal(list))
    30  			},
    31  			Entry("Nil", nil, ""),
    32  			Entry("Empty", []string{}, ""),
    33  			Entry("One", []string{"one"}, "'one'"),
    34  			Entry("Two", []string{"one", "two"}, "'one' and 'two'"),
    35  			Entry("Three", []string{"one", "two", "three"}, "'one', 'two' and 'three'"),
    36  		)
    37  
    38  		It("Doesn't modify the input", func() {
    39  			items := []string{"a", "b", "c"}
    40  			All(items)
    41  			Expect(items).To(Equal([]string{"a", "b", "c"}))
    42  		})
    43  	})
    44  
    45  	Describe("Any", func() {
    46  		DescribeTable("Examples",
    47  			func(items []string, list string) {
    48  				Expect(Any(items)).To(Equal(list))
    49  			},
    50  			Entry("Nil", nil, ""),
    51  			Entry("Empty", []string{}, ""),
    52  			Entry("One", []string{"one"}, "'one'"),
    53  			Entry("Two", []string{"one", "two"}, "'one' or 'two'"),
    54  			Entry("Three", []string{"one", "two", "three"}, "'one', 'two' or 'three'"),
    55  		)
    56  
    57  		It("Doesn't modify the input", func() {
    58  			items := []string{"a", "b", "c"}
    59  			Any(items)
    60  			Expect(items).To(Equal([]string{"a", "b", "c"}))
    61  		})
    62  	})
    63  })