Skip to content

Commit e6b08b9

Browse files
Add tests for Int(_:radix) accepting unintentional cases (SR-187)
1 parent 58bc25b commit e6b08b9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/1_stdlib/NumericParsing.swift.gyb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ tests.test("${Self}/success") {
9292
expectEqual(nil, ${Self}("${minValue - 1}"))
9393
expectEqual(nil, ${Self}("\u{1D7FF}")) // MATHEMATICAL MONOSPACE DIGIT NINE
9494

95+
// Cases that should fail to parse
96+
expectEqual(nil, ${Self}("--0")) // Zero w/ repeated plus
97+
expectEqual(nil, ${Self}("-+5")) // Non-zero with -+
98+
9599
// Do more exhaustive testing
96100
% for radix in radices_to_test:
97101
% for n in required_values + range(

0 commit comments

Comments
 (0)