Skip to content

Commit f57c41d

Browse files
committed
fixed tests
1 parent e0ab4c7 commit f57c41d

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
test:
55
strategy:
66
matrix:
7-
go-version: [1.13]
7+
go-version: [1.15]
88
platform: [ubuntu-latest]
99
runs-on: ${{ matrix.platform }}
1010
steps:

exec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,4 +452,4 @@ func TestExec_Local(t *testing.T) {
452452
require.Equal(t, testCase.wantO, gotO, "Remote() = %v, want %v", gotO, testCase.wantO)
453453
})
454454
}
455-
}
455+
}

options_test.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,21 +224,22 @@ func TestArgument_String(t *testing.T) {
224224

225225
testCases := []testCase{
226226
{
227-
test: "valid with value string type pointer",
227+
test: "invalid with value string type pointer",
228228
arg: &Argument{
229229
Name: "argument",
230230
Type: String,
231231
Value: new(string),
232232
},
233+
expectedPanic: true,
233234
},
234235
{
235-
test: "invalid value string type with no pointer",
236+
test: "valid value string type with no pointer",
236237
arg: &Argument{
237238
Name: "argument",
238239
Type: String,
239240
Value: "string",
240241
},
241-
expectedPanic: true,
242+
expectedPanic: false,
242243
},
243244
{
244245
test: "invalid value int type with no pointer",
@@ -258,7 +259,7 @@ func TestArgument_String(t *testing.T) {
258259
_ = testCase.arg.String()
259260
})
260261
} else {
261-
require.Equal(t, *testCase.arg.Value.(*string), testCase.arg.String())
262+
require.Equal(t, testCase.arg.Value.(string), testCase.arg.String())
262263
}
263264
})
264265
}
@@ -273,21 +274,22 @@ func TestArgument_Int(t *testing.T) {
273274

274275
testCases := []testCase{
275276
{
276-
test: "valid with value int type pointer",
277+
test: "invalid with value int type pointer",
277278
arg: &Argument{
278279
Name: "argument",
279280
Type: Int,
280281
Value: new(int),
281282
},
283+
expectedPanic: true,
282284
},
283285
{
284-
test: "invalid value int type with no pointer",
286+
test: "valid value int type with no pointer",
285287
arg: &Argument{
286288
Name: "argument",
287289
Type: Int,
288290
Value: 0,
289291
},
290-
expectedPanic: true,
292+
expectedPanic: false,
291293
},
292294
{
293295
test: "invalid value string type with no pointer",
@@ -307,7 +309,7 @@ func TestArgument_Int(t *testing.T) {
307309
testCase.arg.Int()
308310
})
309311
} else {
310-
require.Equal(t, *testCase.arg.Value.(*int), testCase.arg.Int())
312+
require.Equal(t, testCase.arg.Value.(int), testCase.arg.Int())
311313
}
312314
})
313315
}
@@ -322,21 +324,22 @@ func TestArgument_Bool(t *testing.T) {
322324

323325
testCases := []testCase{
324326
{
325-
test: "valid with value bool type pointer",
327+
test: "invalid with value bool type pointer",
326328
arg: &Argument{
327329
Name: "argument",
328330
Type: Bool,
329331
Value: new(bool),
330332
},
333+
expectedPanic: true,
331334
},
332335
{
333-
test: "invalid value bool type with no pointer",
336+
test: "valid value bool type with no pointer",
334337
arg: &Argument{
335338
Name: "argument",
336339
Type: Bool,
337340
Value: false,
338341
},
339-
expectedPanic: true,
342+
expectedPanic: false,
340343
},
341344
{
342345
test: "invalid value string type with no pointer",
@@ -356,7 +359,7 @@ func TestArgument_Bool(t *testing.T) {
356359
testCase.arg.Bool()
357360
})
358361
} else {
359-
require.Equal(t, *testCase.arg.Value.(*bool), testCase.arg.Bool())
362+
require.Equal(t, testCase.arg.Value.(bool), testCase.arg.Bool())
360363
}
361364
})
362365
}

0 commit comments

Comments
 (0)