11# @testitem "Binary Operators" begin
22 # using CSTParser: remlineinfo!
33 # include("../shared.jl")
4-
4+
55# for iter = 1:25
66# println(iter)
77# str = join([["x$(randop())" for i = 1:19];"x"])
1313@testitem " Conditional Operator" begin
1414 using CSTParser: remlineinfo!
1515 include (" ../shared.jl" )
16-
16+
1717 @test test_expr (" a ? b : c" )
1818 @test test_expr (" a ? b : c : d" )
1919 @test test_expr (" a ? b : c : d : e" )
2424@testitem " Dot Operator" begin
2525 using CSTParser: remlineinfo!
2626 include (" ../shared.jl" )
27-
27+
2828 @test " a.b" |> test_expr
2929 @test " a.b.c" |> test_expr
3030 @test " (a(b)).c" |> test_expr
3636@testitem " Unary Operator" begin
3737 using CSTParser: remlineinfo!
3838 include (" ../shared.jl" )
39-
39+
4040 @test " +" |> test_expr
4141 @test " -" |> test_expr
4242 @test " !" |> test_expr
4949 @test " √" |> test_expr
5050 @test " ∛" |> test_expr
5151 @test " ∜" |> test_expr
52-
52+
5353 @test " a=b..." |> test_expr
5454 @test " a-->b..." |> test_expr
5555 if VERSION >= v " 1.6"
7777@testitem " unary op calls" begin
7878 using CSTParser: remlineinfo!
7979 include (" ../shared.jl" )
80-
80+
8181 @test " +(a,b)" |> test_expr
8282 @test " -(a,b)" |> test_expr
8383 @test " !(a,b)" |> test_expr
100100@testitem " dotted non-calls" begin
101101 using CSTParser: remlineinfo!
102102 include (" ../shared.jl" )
103-
103+
104104 @test " f(.+)" |> test_expr
105105 @test " f(.-)" |> test_expr
106106 @test " f(.!)" |> test_expr
118118@testitem " comment parsing" begin
119119 using CSTParser: remlineinfo!
120120 include (" ../shared.jl" )
121-
121+
122122 if VERSION >= v " 1.6"
123123 @test " [1#==#2#==#3]" |> test_expr
124124 @test """
@@ -138,27 +138,29 @@ end
138138@testitem " weird quote parsing" begin
139139 using CSTParser: remlineinfo!
140140 include (" ../shared.jl" )
141-
141+
142142 @test " :(;)" |> test_expr
143143 @test " :(;;)" |> test_expr
144144 @test " :(;;;)" |> test_expr
145145end
146146
147- # this errors during *lowering*, not parsing.
148- @testitem " parse const without assignment in quote" begin
149- using CSTParser: remlineinfo!
150- include (" ../shared.jl" )
151-
152- @test " :(global const x)" |> test_expr
153- @test " :(global const x::Int)" |> test_expr
154- @test " :(const global x)" |> test_expr
155- @test " :(const global x::Int)" |> test_expr
147+ # In previous Julia versions, this errored during lowering. With JuliaSyntax, this is a parser error
148+ if VERSION < v " 1.10-"
149+ @testitem " parse const without assignment in quote" begin
150+ using CSTParser: remlineinfo!
151+ include (" ../shared.jl" )
152+
153+ @test " :(global const x)" |> test_expr
154+ @test " :(global const x::Int)" |> test_expr
155+ @test " :(const global x)" |> test_expr
156+ @test " :(const global x::Int)" |> test_expr
157+ end
156158end
157159
158160@testitem " where precedence" begin
159161 using CSTParser: remlineinfo!
160162 include (" ../shared.jl" )
161-
163+
162164 @test " a = b where c = d" |> test_expr
163165 @test " a = b where c" |> test_expr
164166 @test " b where c = d" |> test_expr
0 commit comments