summaryrefslogtreecommitdiff
path: root/parse_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'parse_test.go')
-rw-r--r--parse_test.go15
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