update to latest go-scalar, add test for hex, oct, and binary integer literals
This commit is contained in:
parent
74af96c6cc
commit
ea0f540c40
2
go.mod
2
go.mod
|
@ -1,7 +1,7 @@
|
|||
module github.com/alexflint/go-arg
|
||||
|
||||
require (
|
||||
github.com/alexflint/go-scalar v1.1.0
|
||||
github.com/alexflint/go-scalar v1.2.0
|
||||
github.com/stretchr/testify v1.7.0
|
||||
)
|
||||
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1,5 +1,7 @@
|
|||
github.com/alexflint/go-scalar v1.1.0 h1:aaAouLLzI9TChcPXotr6gUhq+Scr8rl0P9P4PnltbhM=
|
||||
github.com/alexflint/go-scalar v1.1.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
|
||||
github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw=
|
||||
github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
|
|
@ -95,6 +95,21 @@ func TestInt(t *testing.T) {
|
|||
assert.EqualValues(t, 8, *args.Ptr)
|
||||
}
|
||||
|
||||
func TestHexOctBin(t *testing.T) {
|
||||
var args struct {
|
||||
Hex int
|
||||
Oct int
|
||||
Bin int
|
||||
Underscored int
|
||||
}
|
||||
err := parse("--hex 0xA --oct 0o10 --bin 0b101 --underscored 123_456", &args)
|
||||
require.NoError(t, err)
|
||||
assert.EqualValues(t, 10, args.Hex)
|
||||
assert.EqualValues(t, 8, args.Oct)
|
||||
assert.EqualValues(t, 5, args.Bin)
|
||||
assert.EqualValues(t, 123456, args.Underscored)
|
||||
}
|
||||
|
||||
func TestNegativeInt(t *testing.T) {
|
||||
var args struct {
|
||||
Foo int
|
||||
|
|
Loading…
Reference in New Issue