diff --git a/go.mod b/go.mod index 67ac880..944b9bc 100644 --- a/go.mod +++ b/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 ) diff --git a/go.sum b/go.sum index 1170bc7..5b536f9 100644 --- a/go.sum +++ b/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= diff --git a/parse_test.go b/parse_test.go index aebe5ff..4ea6bc4 100644 --- a/parse_test.go +++ b/parse_test.go @@ -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