diff options
author | 2017-09-05 21:39:37 +0200 | |
---|---|---|
committer | 2017-09-06 10:10:15 +0200 | |
commit | 12b2379c4886316be6c2c575eb09f59a7c55cc33 (patch) | |
tree | f1d9efebcc9f5f2421f645309a2e4a4248ae657e /src/test/java/com/google/devtools/build | |
parent | eac5cbb26921a472b096037ef13180b6047e6eb9 (diff) |
Fix crash when calling int(s, 0) where s doesn't specify the radix
Also distinguish between unspecified base arg and base 10, so "int(True, 10)" is now an error. This is an incompatible change, albeit a small one.
RELNOTES: None
PiperOrigin-RevId: 167616143
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java index a373ba7ade..67f691e4cd 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java @@ -1633,7 +1633,9 @@ public class MethodLibraryTest extends EvaluationTestCase { .testStatement("int('11', 9)", 10) .testStatement("int('AF', 16)", 175) .testStatement("int('11', 36)", 37) - .testStatement("int('az', 36)", 395); + .testStatement("int('az', 36)", 395) + .testStatement("int('11', 10)", 11) + .testStatement("int('11', 0)", 11); } @Test @@ -1662,7 +1664,9 @@ public class MethodLibraryTest extends EvaluationTestCase { public void testIntWithBase_NoString() throws Exception { new BothModesTest() .testIfExactError("int() can't convert non-string with explicit base", "int(True, 2)") - .testIfExactError("int() can't convert non-string with explicit base", "int(1, 2)"); + .testIfExactError("int() can't convert non-string with explicit base", "int(1, 2)") + .testIfExactError("int() can't convert non-string with explicit base", "int(True, 10)") + ; } @Test |