Skip to content

Commit

Permalink
Fix various tests for 32 bit Julia
Browse files Browse the repository at this point in the history
Choice on using Int64 or adapting tests to Int were based on smallness of change.
  • Loading branch information
Zentrik committed Jan 7, 2024
1 parent a19b566 commit 326401e
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 63 deletions.
6 changes: 3 additions & 3 deletions TypedSyntax/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ include("test_module.jl")
tsn = TypedSyntaxNode(TSN.summer_iterate, (Vector{Float64},))
@test tsn.typ == Union{Int,Float64}
sig, body = children(tsn)
@test has_name_typ(child(body, 2, 1), :ret, Union{Nothing, Tuple{Float64, Int64}})
@test has_name_typ(child(body, 2, 1), :ret, Union{Nothing, Tuple{Float64, Int}})
@test has_name_typ(child(body, 3, 2, 1, 1, 1), :x, Float64)

# `where`, unnamed arguments, and types-as-arguments
Expand Down Expand Up @@ -552,7 +552,7 @@ include("test_module.jl")
@test TypedSyntax.num_positional_args(tsn) == 2

# Display
tsn = TypedSyntaxNode(TSN.mysin, (Int,))
tsn = TypedSyntaxNode(TSN.mysin, (Int64,))
str = sprint(tsn; context=:color=>false) do io, obj
printstyled(io, obj; hide_type_stable=false)
end
Expand Down Expand Up @@ -602,7 +602,7 @@ include("test_module.jl")
end
@test occursin("[1]\e[36m::Float32\e[39m", str)
@test occursin("[2]\e[36m::Float32\e[39m", str)
tsn = TypedSyntaxNode(TSN.simplef, (Int, Float64))
tsn = TypedSyntaxNode(TSN.simplef, (Int64, Float64))
str = sprint(tsn; context=:color=>false) do io, obj
printstyled(io, obj; hide_type_stable=false)
end
Expand Down
118 changes: 59 additions & 59 deletions test/test_codeview_vscode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ include("test_vscode_example_functions.jl")

fake_terminal() do term, in, out, _
t = @async begin
@test_nowarn descend(fib, (Int64,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode)
@test_nowarn descend(fib, (Int,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode)
end
write(in, 'q')
wait(t)
Expand All @@ -60,18 +60,18 @@ include("test_vscode_example_functions.jl")

if !hide_type_stable && inlay_types_vscode
@test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [
TypedSyntax.InlayHint(1, 14, "::Int64", 1)
TypedSyntax.InlayHint(1, 15, "::Int64", 1)
TypedSyntax.InlayHint(1, 14, "::$Int", 1)
TypedSyntax.InlayHint(1, 15, "::$Int", 1)
TypedSyntax.InlayHint(3, 11, "(", 1)
TypedSyntax.InlayHint(3, 15, "(", 1)
TypedSyntax.InlayHint(3, 16, "::Int64", 1)
TypedSyntax.InlayHint(3, 20, ")::Int64", 1)
TypedSyntax.InlayHint(3, 21, "::Int64", 1)
TypedSyntax.InlayHint(3, 16, "::$Int", 1)
TypedSyntax.InlayHint(3, 20, ")::$Int", 1)
TypedSyntax.InlayHint(3, 21, "::$Int", 1)
TypedSyntax.InlayHint(3, 28, "(", 1)
TypedSyntax.InlayHint(3, 29, "::Int64", 1)
TypedSyntax.InlayHint(3, 33, ")::Int64", 1)
TypedSyntax.InlayHint(3, 34, "::Int64", 1)
TypedSyntax.InlayHint(3, 34, ")::Int64", 1)
TypedSyntax.InlayHint(3, 29, "::$Int", 1)
TypedSyntax.InlayHint(3, 33, ")::$Int", 1)
TypedSyntax.InlayHint(3, 34, "::$Int", 1)
TypedSyntax.InlayHint(3, 34, ")::$Int", 1)
])
elseif hide_type_stable && inlay_types_vscode
@test isempty(VSCodeServer.inlay_hints[1])
Expand All @@ -85,7 +85,7 @@ include("test_vscode_example_functions.jl")

fake_terminal() do term, in, out, _
t = @async begin
@test_nowarn descend(fVSCode, (Int64,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode)
@test_nowarn descend(fVSCode, (Int,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode)
end
write(in, 'q')
wait(t)
Expand Down Expand Up @@ -114,60 +114,60 @@ include("test_vscode_example_functions.jl")
if !hide_type_stable && inlay_types_vscode
if iswarn
@test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [
TypedSyntax.InlayHint(7, 18, "::Int64", 1)
TypedSyntax.InlayHint(7, 19, "::Union{Float64, Int64}", nothing)
TypedSyntax.InlayHint(8, 5, "::Int64", 1)
TypedSyntax.InlayHint(7, 18, "::$Int", 1)
TypedSyntax.InlayHint(7, 19, "::Union{Float64, $Int}", nothing)
TypedSyntax.InlayHint(8, 5, "::$Int", 1)
TypedSyntax.InlayHint(8, 8, "(", 1)
TypedSyntax.InlayHint(8, 9, "::Int64", 1)
TypedSyntax.InlayHint(8, 13, ")::Int64", 1)
TypedSyntax.InlayHint(9, 5, "::Int64", 1)
TypedSyntax.InlayHint(8, 9, "::$Int", 1)
TypedSyntax.InlayHint(8, 13, ")::$Int", 1)
TypedSyntax.InlayHint(9, 5, "::$Int", 1)
TypedSyntax.InlayHint(9, 8, "(", 1)
TypedSyntax.InlayHint(9, 13, "::Int64", 1)
TypedSyntax.InlayHint(9, 13, ")::Int64", 1)
TypedSyntax.InlayHint(9, 13, "::$Int", 1)
TypedSyntax.InlayHint(9, 13, ")::$Int", 1)
TypedSyntax.InlayHint(10, 11, "(", 1)
TypedSyntax.InlayHint(10, 12, "::Int64", 1)
TypedSyntax.InlayHint(10, 12, "::$Int", 1)
TypedSyntax.InlayHint(10, 16, "(", 1)
TypedSyntax.InlayHint(10, 17, "::Int64", 1)
TypedSyntax.InlayHint(10, 17, "::$Int", 1)
TypedSyntax.InlayHint(10, 21, ")::Bool", 1)
TypedSyntax.InlayHint(10, 26, "::Int64", 1)
TypedSyntax.InlayHint(10, 26, "::$Int", 1)
TypedSyntax.InlayHint(10, 32, "::Float64", 1)
TypedSyntax.InlayHint(10, 33, ")::Union{Float64, Int64}", nothing)
TypedSyntax.InlayHint(10, 33, ")::Union{Float64, $Int}", nothing)
])

else
@test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [
TypedSyntax.InlayHint(7, 18, "::Int64", 1)
TypedSyntax.InlayHint(7, 19, "::Union{Float64, Int64}", 1)
TypedSyntax.InlayHint(8, 5, "::Int64", 1)
TypedSyntax.InlayHint(7, 18, "::$Int", 1)
TypedSyntax.InlayHint(7, 19, "::Union{Float64, $Int}", 1)
TypedSyntax.InlayHint(8, 5, "::$Int", 1)
TypedSyntax.InlayHint(8, 8, "(", 1)
TypedSyntax.InlayHint(8, 9, "::Int64", 1)
TypedSyntax.InlayHint(8, 13, ")::Int64", 1)
TypedSyntax.InlayHint(9, 5, "::Int64", 1)
TypedSyntax.InlayHint(8, 9, "::$Int", 1)
TypedSyntax.InlayHint(8, 13, ")::$Int", 1)
TypedSyntax.InlayHint(9, 5, "::$Int", 1)
TypedSyntax.InlayHint(9, 8, "(", 1)
TypedSyntax.InlayHint(9, 13, "::Int64", 1)
TypedSyntax.InlayHint(9, 13, ")::Int64", 1)
TypedSyntax.InlayHint(9, 13, "::$Int", 1)
TypedSyntax.InlayHint(9, 13, ")::$Int", 1)
TypedSyntax.InlayHint(10, 11, "(", 1)
TypedSyntax.InlayHint(10, 12, "::Int64", 1)
TypedSyntax.InlayHint(10, 12, "::$Int", 1)
TypedSyntax.InlayHint(10, 16, "(", 1)
TypedSyntax.InlayHint(10, 17, "::Int64", 1)
TypedSyntax.InlayHint(10, 17, "::$Int", 1)
TypedSyntax.InlayHint(10, 21, ")::Bool", 1)
TypedSyntax.InlayHint(10, 26, "::Int64", 1)
TypedSyntax.InlayHint(10, 26, "::$Int", 1)
TypedSyntax.InlayHint(10, 32, "::Float64", 1)
TypedSyntax.InlayHint(10, 33, ")::Union{Float64, Int64}", 1)
TypedSyntax.InlayHint(10, 33, ")::Union{Float64, $Int}", 1)
])
end
elseif hide_type_stable && inlay_types_vscode
if iswarn
@test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [
TypedSyntax.InlayHint(7, 19, "::Union{Float64, Int64}", nothing)
TypedSyntax.InlayHint(7, 19, "::Union{Float64, $Int}", nothing)
TypedSyntax.InlayHint(10, 11, "(", 1)
TypedSyntax.InlayHint(10, 33, ")::Union{Float64, Int64}", nothing)
TypedSyntax.InlayHint(10, 33, ")::Union{Float64, $Int}", nothing)
])
else
@test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [
TypedSyntax.InlayHint(7, 19, "::Union{Float64, Int64}", 1)
TypedSyntax.InlayHint(7, 19, "::Union{Float64, $Int}", 1)
TypedSyntax.InlayHint(10, 11, "(", 1)
TypedSyntax.InlayHint(10, 33, ")::Union{Float64, Int64}", 1)
TypedSyntax.InlayHint(10, 33, ")::Union{Float64, $Int}", 1)
])
end
end
Expand Down Expand Up @@ -206,11 +206,11 @@ include("test_vscode_example_functions.jl")
if !hide_type_stable && inlay_types_vscode
@test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [
TypedSyntax.InlayHint(14, 18, "::Float64", 1)
TypedSyntax.InlayHint(14, 19, "::Int64", 1)
TypedSyntax.InlayHint(14, 19, "::$Int", 1)
TypedSyntax.InlayHint(15, 15, "::Float64", 1)
TypedSyntax.InlayHint(15, 16, "::Int64", 1)
TypedSyntax.InlayHint(15, 16, "::$Int", 1)
TypedSyntax.InlayHint(16, 9, "::Float64", 1)
TypedSyntax.InlayHint(16, 10, "::Int64", 1)
TypedSyntax.InlayHint(16, 10, "::$Int", 1)
])
elseif hide_type_stable && inlay_types_vscode
@test isempty(VSCodeServer.inlay_hints[1])
Expand All @@ -219,12 +219,12 @@ include("test_vscode_example_functions.jl")
end

for inlay_types_vscode in (true, false), diagnostics_vscode in (true, false), iswarn in (true, false), hide_type_stable in (true, false)
@testset "fibcall Int64 inlay_types_vscode=$inlay_types_vscode, diagnostics_vscode=$diagnostics_vscode, iswarn=$iswarn, hide_type_stable=$hide_type_stable" begin
@testset "fibcall $Int inlay_types_vscode=$inlay_types_vscode, diagnostics_vscode=$diagnostics_vscode, iswarn=$iswarn, hide_type_stable=$hide_type_stable" begin
VSCodeServer.reset_test_containers()

fake_terminal() do term, in, out, _
t = @async begin
@test_nowarn descend(fibcall, (Int64,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode)
@test_nowarn descend(fibcall, (Int,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode)
end
write(in, 'q')
wait(t)
Expand All @@ -248,24 +248,24 @@ include("test_vscode_example_functions.jl")

if !hide_type_stable && inlay_types_vscode
@test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [
TypedSyntax.InlayHint(14, 18, "::Int64", 1)
TypedSyntax.InlayHint(14, 19, "::Int64", 1)
TypedSyntax.InlayHint(15, 15, "::Int64", 1)
TypedSyntax.InlayHint(15, 16, "::Int64", 1)
TypedSyntax.InlayHint(16, 9, "::Int64", 1)
TypedSyntax.InlayHint(16, 10, "::Int64", 1)
TypedSyntax.InlayHint(1, 14, "::Int64", 1)
TypedSyntax.InlayHint(1, 15, "::Int64", 1)
TypedSyntax.InlayHint(14, 18, "::$Int", 1)
TypedSyntax.InlayHint(14, 19, "::$Int", 1)
TypedSyntax.InlayHint(15, 15, "::$Int", 1)
TypedSyntax.InlayHint(15, 16, "::$Int", 1)
TypedSyntax.InlayHint(16, 9, "::$Int", 1)
TypedSyntax.InlayHint(16, 10, "::$Int", 1)
TypedSyntax.InlayHint(1, 14, "::$Int", 1)
TypedSyntax.InlayHint(1, 15, "::$Int", 1)
TypedSyntax.InlayHint(3, 11, "(", 1)
TypedSyntax.InlayHint(3, 15, "(", 1)
TypedSyntax.InlayHint(3, 16, "::Int64", 1)
TypedSyntax.InlayHint(3, 20, ")::Int64", 1)
TypedSyntax.InlayHint(3, 21, "::Int64", 1)
TypedSyntax.InlayHint(3, 16, "::$Int", 1)
TypedSyntax.InlayHint(3, 20, ")::$Int", 1)
TypedSyntax.InlayHint(3, 21, "::$Int", 1)
TypedSyntax.InlayHint(3, 28, "(", 1)
TypedSyntax.InlayHint(3, 29, "::Int64", 1)
TypedSyntax.InlayHint(3, 33, ")::Int64", 1)
TypedSyntax.InlayHint(3, 34, "::Int64", 1)
TypedSyntax.InlayHint(3, 34, ")::Int64", 1)
TypedSyntax.InlayHint(3, 29, "::$Int", 1)
TypedSyntax.InlayHint(3, 33, ")::$Int", 1)
TypedSyntax.InlayHint(3, 34, "::$Int", 1)
TypedSyntax.InlayHint(3, 34, ")::$Int", 1)
])
elseif hide_type_stable && inlay_types_vscode
@test isempty(VSCodeServer.inlay_hints[1])
Expand Down
2 changes: 1 addition & 1 deletion test/test_vscode_example_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ end

# exact location in file matters
function fibcall(n)
fib(Int64(n))
fib(Int(n))
fib(n)
end

0 comments on commit 326401e

Please sign in to comment.