From da9755368b5db41123c8f945fecedd135e9f894a Mon Sep 17 00:00:00 2001 From: cui fliter Date: Mon, 12 Sep 2022 17:11:51 +0800 Subject: [PATCH] strconv: add a test case when base is illegal Signed-off-by: cui fliter --- src/strconv/itoa_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/strconv/itoa_test.go b/src/strconv/itoa_test.go index b5ee3aa828..b8bc52490a 100644 --- a/src/strconv/itoa_test.go +++ b/src/strconv/itoa_test.go @@ -93,6 +93,14 @@ func TestItoa(t *testing.T) { } } } + + // Override when base is illegal + defer func() { + if r := recover(); r == nil { + t.Fatalf("expected panic due to illegal base") + } + }() + FormatUint(12345678, 1) } type uitob64Test struct {