@@ -8,26 +8,26 @@ import (
8
8
"github.com/stretchr/testify/require"
9
9
"github.com/vmihailenco/msgpack/v5"
10
10
11
- td "github.com/tarantool/go-option/cmd/gentypes/test"
11
+ "github.com/tarantool/go-option/cmd/gentypes/internal /test"
12
12
)
13
13
14
14
func TestOptionalMsgpackExtType_RoundtripLL (t * testing.T ) {
15
15
t .Parallel ()
16
16
17
- input := td .FullMsgpackExtType {
17
+ input := test .FullMsgpackExtType {
18
18
A : 412 ,
19
19
B : "bababa" ,
20
20
}
21
21
22
- opt := td .SomeOptionalFullMsgpackExtType (input )
22
+ opt := test .SomeOptionalFullMsgpackExtType (input )
23
23
24
24
b := bytes.Buffer {}
25
25
enc := msgpack .NewEncoder (& b )
26
26
dec := msgpack .NewDecoder (& b )
27
27
28
28
require .NoError (t , opt .EncodeMsgpack (enc ))
29
29
30
- opt2 := td .NoneOptionalFullMsgpackExtType ()
30
+ opt2 := test .NoneOptionalFullMsgpackExtType ()
31
31
require .NoError (t , opt2 .DecodeMsgpack (dec ))
32
32
33
33
assert .Equal (t , opt , opt2 )
@@ -37,20 +37,20 @@ func TestOptionalMsgpackExtType_RoundtripLL(t *testing.T) {
37
37
func TestOptionalMsgpackExtType_RoundtripHL (t * testing.T ) {
38
38
t .Parallel ()
39
39
40
- input := td .FullMsgpackExtType {
40
+ input := test .FullMsgpackExtType {
41
41
A : 412 ,
42
42
B : "bababa" ,
43
43
}
44
44
45
- opt := td .SomeOptionalFullMsgpackExtType (input )
45
+ opt := test .SomeOptionalFullMsgpackExtType (input )
46
46
47
47
b := bytes.Buffer {}
48
48
enc := msgpack .NewEncoder (& b )
49
49
dec := msgpack .NewDecoder (& b )
50
50
51
51
require .NoError (t , enc .Encode (opt ))
52
52
53
- opt2 := td .NoneOptionalFullMsgpackExtType ()
53
+ opt2 := test .NoneOptionalFullMsgpackExtType ()
54
54
require .NoError (t , dec .Decode (& opt2 ))
55
55
56
56
assert .Equal (t , opt , opt2 )
@@ -63,20 +63,20 @@ func TestOptionalFullMsgpackExtType_IsSome(t *testing.T) {
63
63
t .Run ("some" , func (t * testing.T ) {
64
64
t .Parallel ()
65
65
66
- input := td .FullMsgpackExtType {
66
+ input := test .FullMsgpackExtType {
67
67
A : 412 ,
68
68
B : "bababa" ,
69
69
}
70
70
71
- opt := td .SomeOptionalFullMsgpackExtType (input )
71
+ opt := test .SomeOptionalFullMsgpackExtType (input )
72
72
73
73
assert .True (t , opt .IsSome ())
74
74
})
75
75
76
76
t .Run ("none" , func (t * testing.T ) {
77
77
t .Parallel ()
78
78
79
- opt := td .NoneOptionalFullMsgpackExtType ()
79
+ opt := test .NoneOptionalFullMsgpackExtType ()
80
80
81
81
assert .False (t , opt .IsSome ())
82
82
})
@@ -88,20 +88,20 @@ func TestOptionalFullMsgpackExtType_IsZero(t *testing.T) {
88
88
t .Run ("some" , func (t * testing.T ) {
89
89
t .Parallel ()
90
90
91
- input := td .FullMsgpackExtType {
91
+ input := test .FullMsgpackExtType {
92
92
A : 412 ,
93
93
B : "bababa" ,
94
94
}
95
95
96
- opt := td .SomeOptionalFullMsgpackExtType (input )
96
+ opt := test .SomeOptionalFullMsgpackExtType (input )
97
97
98
98
assert .False (t , opt .IsZero ())
99
99
})
100
100
101
101
t .Run ("none" , func (t * testing.T ) {
102
102
t .Parallel ()
103
103
104
- opt := td .NoneOptionalFullMsgpackExtType ()
104
+ opt := test .NoneOptionalFullMsgpackExtType ()
105
105
106
106
assert .True (t , opt .IsZero ())
107
107
})
@@ -113,12 +113,12 @@ func TestOptionalFullMsgpackExtType_Get(t *testing.T) {
113
113
t .Run ("some" , func (t * testing.T ) {
114
114
t .Parallel ()
115
115
116
- input := td .FullMsgpackExtType {
116
+ input := test .FullMsgpackExtType {
117
117
A : 412 ,
118
118
B : "bababa" ,
119
119
}
120
120
121
- opt := td .SomeOptionalFullMsgpackExtType (input )
121
+ opt := test .SomeOptionalFullMsgpackExtType (input )
122
122
123
123
val , ok := opt .Get ()
124
124
require .True (t , ok )
@@ -128,10 +128,10 @@ func TestOptionalFullMsgpackExtType_Get(t *testing.T) {
128
128
t .Run ("none" , func (t * testing.T ) {
129
129
t .Parallel ()
130
130
131
- opt := td .NoneOptionalFullMsgpackExtType ()
131
+ opt := test .NoneOptionalFullMsgpackExtType ()
132
132
val , ok := opt .Get ()
133
133
require .False (t , ok )
134
- assert .Equal (t , td .NewEmptyFullMsgpackExtType (), val )
134
+ assert .Equal (t , test .NewEmptyFullMsgpackExtType (), val )
135
135
})
136
136
}
137
137
@@ -141,14 +141,14 @@ func TestOptionalFullMsgpackExtType_MustGet(t *testing.T) {
141
141
t .Run ("some" , func (t * testing.T ) {
142
142
t .Parallel ()
143
143
144
- input := td .FullMsgpackExtType {
144
+ input := test .FullMsgpackExtType {
145
145
A : 412 ,
146
146
B : "bababa" ,
147
147
}
148
148
149
- opt := td .SomeOptionalFullMsgpackExtType (input )
149
+ opt := test .SomeOptionalFullMsgpackExtType (input )
150
150
151
- var val td .FullMsgpackExtType
151
+ var val test .FullMsgpackExtType
152
152
153
153
require .NotPanics (t , func () {
154
154
val = opt .MustGet ()
@@ -159,7 +159,7 @@ func TestOptionalFullMsgpackExtType_MustGet(t *testing.T) {
159
159
t .Run ("none" , func (t * testing.T ) {
160
160
t .Parallel ()
161
161
162
- opt := td .NoneOptionalFullMsgpackExtType ()
162
+ opt := test .NoneOptionalFullMsgpackExtType ()
163
163
164
164
require .Panics (t , func () { opt .MustGet () })
165
165
})
@@ -171,21 +171,21 @@ func TestOptionalFullMsgpackExtType_Unwrap(t *testing.T) {
171
171
t .Run ("some" , func (t * testing.T ) {
172
172
t .Parallel ()
173
173
174
- input := td .FullMsgpackExtType {
174
+ input := test .FullMsgpackExtType {
175
175
A : 412 ,
176
176
B : "bababa" ,
177
177
}
178
178
179
- opt := td .SomeOptionalFullMsgpackExtType (input )
179
+ opt := test .SomeOptionalFullMsgpackExtType (input )
180
180
181
181
assert .Equal (t , input , opt .Unwrap ())
182
182
})
183
183
184
184
t .Run ("none" , func (t * testing.T ) {
185
185
t .Parallel ()
186
186
187
- opt := td .NoneOptionalFullMsgpackExtType ()
188
- assert .Equal (t , td .NewEmptyFullMsgpackExtType (), opt .Unwrap ())
187
+ opt := test .NoneOptionalFullMsgpackExtType ()
188
+ assert .Equal (t , test .NewEmptyFullMsgpackExtType (), opt .Unwrap ())
189
189
})
190
190
}
191
191
@@ -195,25 +195,25 @@ func TestOptionalFullMsgpackExtType_UnwrapOr(t *testing.T) {
195
195
t .Run ("some" , func (t * testing.T ) {
196
196
t .Parallel ()
197
197
198
- input := td .FullMsgpackExtType {
198
+ input := test .FullMsgpackExtType {
199
199
A : 412 ,
200
200
B : "bababa" ,
201
201
}
202
202
203
- opt := td .SomeOptionalFullMsgpackExtType (input )
203
+ opt := test .SomeOptionalFullMsgpackExtType (input )
204
204
205
- assert .Equal (t , input , opt .UnwrapOr (td .NewEmptyFullMsgpackExtType ()))
205
+ assert .Equal (t , input , opt .UnwrapOr (test .NewEmptyFullMsgpackExtType ()))
206
206
})
207
207
208
208
t .Run ("none" , func (t * testing.T ) {
209
209
t .Parallel ()
210
210
211
- alt := td .FullMsgpackExtType {
211
+ alt := test .FullMsgpackExtType {
212
212
A : 1 ,
213
213
B : "b" ,
214
214
}
215
215
216
- opt := td .NoneOptionalFullMsgpackExtType ()
216
+ opt := test .NoneOptionalFullMsgpackExtType ()
217
217
assert .Equal (t , alt , opt .UnwrapOr (alt ))
218
218
})
219
219
}
@@ -224,27 +224,27 @@ func TestOptionalFullMsgpackExtType_UnwrapOrElse(t *testing.T) {
224
224
t .Run ("some" , func (t * testing.T ) {
225
225
t .Parallel ()
226
226
227
- input := td .FullMsgpackExtType {
227
+ input := test .FullMsgpackExtType {
228
228
A : 412 ,
229
229
B : "bababa" ,
230
230
}
231
231
232
- opt := td .SomeOptionalFullMsgpackExtType (input )
232
+ opt := test .SomeOptionalFullMsgpackExtType (input )
233
233
234
- assert .Equal (t , input , opt .UnwrapOrElse (td .NewEmptyFullMsgpackExtType ))
234
+ assert .Equal (t , input , opt .UnwrapOrElse (test .NewEmptyFullMsgpackExtType ))
235
235
})
236
236
237
237
t .Run ("none" , func (t * testing.T ) {
238
238
t .Parallel ()
239
239
240
- alt := td .FullMsgpackExtType {
240
+ alt := test .FullMsgpackExtType {
241
241
A : 1 ,
242
242
B : "b" ,
243
243
}
244
244
245
- opt := td .NoneOptionalFullMsgpackExtType ()
245
+ opt := test .NoneOptionalFullMsgpackExtType ()
246
246
247
- assert .Equal (t , alt , opt .UnwrapOrElse (func () td .FullMsgpackExtType {
247
+ assert .Equal (t , alt , opt .UnwrapOrElse (func () test .FullMsgpackExtType {
248
248
return alt
249
249
}))
250
250
})
0 commit comments