1
1
package pkg
2
2
3
3
import (
4
- "encoding/json"
5
4
"reflect"
6
5
"testing"
7
6
"time"
@@ -103,27 +102,6 @@ func TestSplitByComma(t *testing.T) {
103
102
}
104
103
}
105
104
106
- func TestOneOrList (t * testing.T ) {
107
- tests := []struct {
108
- name string
109
- in string
110
- want []string
111
- }{
112
- {"empty" , `[]` , []string {}},
113
- {"string" , `"a"` , []string {"a" }},
114
- {"one" , `["a"]` , []string {"a" }},
115
- {"two" , `["a","b"]` , []string {"a" , "b" }},
116
- }
117
- for _ , tt := range tests {
118
- t .Run (tt .name , func (t * testing.T ) {
119
- var got OneOrList
120
- if err := json .Unmarshal ([]byte (tt .in ), & got ); err != nil || ! reflect .DeepEqual ([]string (got ), tt .want ) {
121
- t .Errorf ("OneOrList(%v) = %v, want %v: %v" , tt .in , got , tt .want , err )
122
- }
123
- })
124
- }
125
- }
126
-
127
105
func TestRandomID (t * testing.T ) {
128
106
var unique = make (map [string ]bool )
129
107
for range 100 {
@@ -138,28 +116,6 @@ func TestRandomID(t *testing.T) {
138
116
}
139
117
}
140
118
141
- func TestContains (t * testing.T ) {
142
- tests := []struct {
143
- name string
144
- slice []int
145
- value int
146
- expected bool
147
- }{
148
- {"Empty slice" , []int {}, 1 , false },
149
- {"Single element" , []int {1 }, 1 , true },
150
- {"Multiple elements" , []int {1 , 2 , 3 , 4 , 5 }, 3 , true },
151
- {"Non-existent element" , []int {1 , 2 , 3 , 4 , 5 }, 6 , false },
152
- }
153
-
154
- for _ , tt := range tests {
155
- t .Run (tt .name , func (t * testing.T ) {
156
- if got := Contains (tt .slice , tt .value ); got != tt .expected {
157
- t .Errorf ("Contains() returned %v, expected %v" , got , tt .expected )
158
- }
159
- })
160
- }
161
- }
162
-
163
119
func TestIsValidTime (t * testing.T ) {
164
120
tests := []struct {
165
121
name string
0 commit comments