diff --git a/test/runtests.jl b/test/runtests.jl index 925b411..d0173d8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -360,22 +360,24 @@ end @test format_string( "try\n$(sp)x\n$(sp)finally\n$(sp)y\n$(sp)catch err\n$(sp)z\n$(sp)end", ) == "try\n x\nfinally\n y\ncatch err\n z\nend" - # try-catch-else-end - @test format_string( - "try\n$(sp)x\n$(sp)catch\n$(sp)y\n$(sp)else\n$(sp)z\n$(sp)end", - ) == "try\n x\ncatch\n y\nelse\n z\nend" - # try-catch(err)-else-end - @test format_string( - "try\n$(sp)x\n$(sp)catch err\n$(sp)y\n$(sp)else\n$(sp)z\n$(sp)end", - ) == "try\n x\ncatch err\n y\nelse\n z\nend" - # try-catch-else-finally-end - @test format_string( - "try\n$(sp)x\n$(sp)catch\n$(sp)y\n$(sp)else\n$(sp)z\n$(sp)finally\n$(sp)z\n$(sp)end", - ) == "try\n x\ncatch\n y\nelse\n z\nfinally\n z\nend" - # try-catch(err)-else-finally-end - @test format_string( - "try\n$(sp)x\n$(sp)catch err\n$(sp)y\n$(sp)else\n$(sp)z\n$(sp)finally\n$(sp)z\n$(sp)end", - ) == "try\n x\ncatch err\n y\nelse\n z\nfinally\n z\nend" + if VERSION >= v"1.8" + # try-catch-else-end + @test format_string( + "try\n$(sp)x\n$(sp)catch\n$(sp)y\n$(sp)else\n$(sp)z\n$(sp)end", + ) == "try\n x\ncatch\n y\nelse\n z\nend" + # try-catch(err)-else-end + @test format_string( + "try\n$(sp)x\n$(sp)catch err\n$(sp)y\n$(sp)else\n$(sp)z\n$(sp)end", + ) == "try\n x\ncatch err\n y\nelse\n z\nend" + # try-catch-else-finally-end + @test format_string( + "try\n$(sp)x\n$(sp)catch\n$(sp)y\n$(sp)else\n$(sp)z\n$(sp)finally\n$(sp)z\n$(sp)end", + ) == "try\n x\ncatch\n y\nelse\n z\nfinally\n z\nend" + # try-catch(err)-else-finally-end + @test format_string( + "try\n$(sp)x\n$(sp)catch err\n$(sp)y\n$(sp)else\n$(sp)z\n$(sp)finally\n$(sp)z\n$(sp)end", + ) == "try\n x\ncatch err\n y\nelse\n z\nfinally\n z\nend" + end # do-end @test format_string("open() do\n$(sp)a\n$(sp)end") == "open() do\n a\nend" @test format_string("open() do io\n$(sp)a\n$(sp)end") == "open() do io\n a\nend"