From: cui fliter Date: Mon, 12 Sep 2022 09:27:11 +0000 (+0000) Subject: strconv: add a test case when base is illegal X-Git-Tag: go1.20rc1~1042 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=95ec579eb68fcc01975462a74676e3bacd9814b0;p=gostls13.git strconv: add a test case when base is illegal Increase unit test coverage of strconv/itoa.go from 83.8% to 85% Change-Id: I0abdfc70a3f06251106f229c12ffb105eeb43fc8 GitHub-Last-Rev: da9755368b5db41123c8f945fecedd135e9f894a GitHub-Pull-Request: golang/go#55014 Reviewed-on: https://go-review.googlesource.com/c/go/+/430137 Reviewed-by: Ian Lance Taylor Run-TryBot: Jenny Rakoczy Reviewed-by: Jenny Rakoczy TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Auto-Submit: Jenny Rakoczy --- 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 {