Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ function strip_gensym(str::AbstractString)
if startswith(str, '#')
idx = findnext('#', str, 2)
if idx !== nothing
return Symbol(str[2:idx-1])
return Symbol(str[2:prevind(str, idx)])
end
end
endswith(str, "##kw") && return Symbol(str[1:end-4])
endswith(str, "##kw") && return Symbol(str[1:prevind(str, end-3)])
return Symbol(str)
end

Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,8 @@ end
body, _ = CodeTracking.definition(String, which(diffminmax, (Any,)))
@test body == "diffminmax((min, max)) = max - min"
end

@testset "strip_gensym with unicode" begin
@test CodeTracking.strip_gensym("#𝓔′#90") == :𝓔′
@test CodeTracking.strip_gensym("𝓔′##kw") == :𝓔′
end