diff options
| author | Alex Flint <[email protected]> | 2022-10-02 13:05:04 -0700 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2022-10-02 13:05:04 -0700 |
| commit | ea0f540c400aa3f0646c94a65458abe866f752b6 (patch) | |
| tree | f221fa2dfa7ee0bc301afc165aaad8886d9b1190 /parse_test.go | |
| parent | 74af96c6ccf404613c251bca4814d32c69047c5f (diff) | |
update to latest go-scalar, add test for hex, oct, and binary integer literals
Diffstat (limited to 'parse_test.go')
| -rw-r--r-- | parse_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
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 |
