]> Cypherpunks repositories - gostls13.git/commitdiff
strconv: add a test case when base is illegal
authorcui fliter <imcusg@gmail.com>
Mon, 12 Sep 2022 09:27:11 +0000 (09:27 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 15 Sep 2022 21:09:39 +0000 (21:09 +0000)
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 <iant@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>

src/strconv/itoa_test.go

index b5ee3aa82803706ac623c66a498ebe7b6178d61f..b8bc52490a9723274321a7ee4dfd9a97cef00cd9 100644 (file)
@@ -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 {