Skip to content

Commit

Permalink
extend the API for LazyString a bit (#44581)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Mar 12, 2022
1 parent 2cba553 commit e6c1525
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/strings/lazy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ iterate(s::LazyString, i::Integer) = iterate(String(s), i)
isequal(a::LazyString, b::LazyString) = isequal(String(a), String(b))
==(a::LazyString, b::LazyString) = (String(a) == String(b))
ncodeunits(s::LazyString) = ncodeunits(String(s))
codeunit(s::LazyString) = codeunit(String(s))
codeunit(s::LazyString, i::Integer) = codeunit(String(s), i)
isvalid(s::LazyString, i::Integer) = isvalid(String(s), i)
4 changes: 4 additions & 0 deletions test/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1100,4 +1100,8 @@ end
let d = Dict(lazy"$(1+2) is 3" => 3)
@test d["3 is 3"] == 3
end
l = lazy"1+2"
@test codeunit(l) == UInt8
@test codeunit(l,2) == 0x2b
@test isvalid(l, 1)
end

0 comments on commit e6c1525

Please sign in to comment.