From ad63b1b0fae4d6595c18491c5549371c47fd4255 Mon Sep 17 00:00:00 2001 From: Sam O'Connor Date: Wed, 3 Oct 2018 08:04:55 +1000 Subject: [PATCH] Issue #29451 test --- test/parse.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/parse.jl b/test/parse.jl index c3b49ebdc7e1c..5bf3b806edca8 100644 --- a/test/parse.jl +++ b/test/parse.jl @@ -30,6 +30,16 @@ @test_throws ArgumentError parse(Int, 'a') @test_throws ArgumentError parse(Int,typemax(Char)) +# Issue 29451 +struct Issue29451String <: AbstractString end +Base.ncodeunits(::Issue29451String) = 12345 +Base.lastindex(::Issue29451String) = 1 +Base.isvalid(::Issue29451String, i::Integer) = i == 1 +Base.iterate(::Issue29451String, i::Integer=1) = i == 1 ? ('0', 2) : nothing + +@test Issue29451String() == "0" +@test parse(Int, Issue29451String()) == 0 + # Issue 20587 for T in Any[BigInt, Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8] T === BigInt && continue # TODO: make BigInt pass this test