Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radutopala committed May 26, 2021
1 parent e0ab4c7 commit f57c41d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.13]
go-version: [1.15]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,4 @@ func TestExec_Local(t *testing.T) {
require.Equal(t, testCase.wantO, gotO, "Remote() = %v, want %v", gotO, testCase.wantO)
})
}
}
}
27 changes: 15 additions & 12 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,21 +224,22 @@ func TestArgument_String(t *testing.T) {

testCases := []testCase{
{
test: "valid with value string type pointer",
test: "invalid with value string type pointer",
arg: &Argument{
Name: "argument",
Type: String,
Value: new(string),
},
expectedPanic: true,
},
{
test: "invalid value string type with no pointer",
test: "valid value string type with no pointer",
arg: &Argument{
Name: "argument",
Type: String,
Value: "string",
},
expectedPanic: true,
expectedPanic: false,
},
{
test: "invalid value int type with no pointer",
Expand All @@ -258,7 +259,7 @@ func TestArgument_String(t *testing.T) {
_ = testCase.arg.String()
})
} else {
require.Equal(t, *testCase.arg.Value.(*string), testCase.arg.String())
require.Equal(t, testCase.arg.Value.(string), testCase.arg.String())
}
})
}
Expand All @@ -273,21 +274,22 @@ func TestArgument_Int(t *testing.T) {

testCases := []testCase{
{
test: "valid with value int type pointer",
test: "invalid with value int type pointer",
arg: &Argument{
Name: "argument",
Type: Int,
Value: new(int),
},
expectedPanic: true,
},
{
test: "invalid value int type with no pointer",
test: "valid value int type with no pointer",
arg: &Argument{
Name: "argument",
Type: Int,
Value: 0,
},
expectedPanic: true,
expectedPanic: false,
},
{
test: "invalid value string type with no pointer",
Expand All @@ -307,7 +309,7 @@ func TestArgument_Int(t *testing.T) {
testCase.arg.Int()
})
} else {
require.Equal(t, *testCase.arg.Value.(*int), testCase.arg.Int())
require.Equal(t, testCase.arg.Value.(int), testCase.arg.Int())
}
})
}
Expand All @@ -322,21 +324,22 @@ func TestArgument_Bool(t *testing.T) {

testCases := []testCase{
{
test: "valid with value bool type pointer",
test: "invalid with value bool type pointer",
arg: &Argument{
Name: "argument",
Type: Bool,
Value: new(bool),
},
expectedPanic: true,
},
{
test: "invalid value bool type with no pointer",
test: "valid value bool type with no pointer",
arg: &Argument{
Name: "argument",
Type: Bool,
Value: false,
},
expectedPanic: true,
expectedPanic: false,
},
{
test: "invalid value string type with no pointer",
Expand All @@ -356,7 +359,7 @@ func TestArgument_Bool(t *testing.T) {
testCase.arg.Bool()
})
} else {
require.Equal(t, *testCase.arg.Value.(*bool), testCase.arg.Bool())
require.Equal(t, testCase.arg.Value.(bool), testCase.arg.Bool())
}
})
}
Expand Down

0 comments on commit f57c41d

Please sign in to comment.