Merge pull request #195 from alexflint/bump_scalar_dep

Update to latest go-scalar
This commit is contained in:
Alex Flint 2022-10-02 13:07:36 -07:00 committed by GitHub
commit 0c21f821f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

2
go.mod
View File

@ -1,7 +1,7 @@
module github.com/alexflint/go-arg module github.com/alexflint/go-arg
require ( require (
github.com/alexflint/go-scalar v1.1.0 github.com/alexflint/go-scalar v1.2.0
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
) )

2
go.sum
View File

@ -1,5 +1,7 @@
github.com/alexflint/go-scalar v1.1.0 h1:aaAouLLzI9TChcPXotr6gUhq+Scr8rl0P9P4PnltbhM= 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.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.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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

View File

@ -95,6 +95,21 @@ func TestInt(t *testing.T) {
assert.EqualValues(t, 8, *args.Ptr) 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) { func TestNegativeInt(t *testing.T) {
var args struct { var args struct {
Foo int Foo int