Skip to content

Commit

Permalink
Require Julia version 1.10 (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored Oct 18, 2024
1 parent 78ee7fb commit 500ba09
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 66 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/Check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1.7'
- '1.8'
- '1.9'
- '1.10'
- '1'
- 'nightly'
env:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1.7'
- '1.8'
- '1.9'
- '1.10'
- '1'
- 'nightly'
os:
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Preferences = "21216c6a-2e73-6563-6e65-726566657250"
[compat]
JuliaSyntax = "0.4.10"
Preferences = "1"
julia = "1.10"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
17 changes: 4 additions & 13 deletions src/Runic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ module Runic
using JuliaSyntax:
JuliaSyntax, @K_str, @KSet_str

# Julia compat for const struct fields
@eval macro $(Symbol("const"))(field)
if VERSION >= v"1.8.0-DEV.1148"
Expr(:const, esc(field))
else
return esc(field)
end
end

# Debug and assert utilities
include("debug.jl")
include("JuliaSyntax.jl")
Expand Down Expand Up @@ -121,11 +112,11 @@ end

mutable struct Context
# Input
@const src_str::String
@const src_tree::Node
@const src_io::IOBuffer
const src_str::String
const src_tree::Node
const src_io::IOBuffer
# Output
@const fmt_io::IOBuffer
const fmt_io::IOBuffer
fmt_tree::Union{Node, Nothing}
# User settings
quiet::Bool
Expand Down
5 changes: 0 additions & 5 deletions src/debug.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
# Debug info #
##############

# @lock is defined but not exported in older Julia versions
if VERSION < v"1.7.0"
using Base: @lock
end

# Code derived from ToggleableAsserts.jl kept in a separate file
include("ToggleableAsserts.jl")

Expand Down
7 changes: 2 additions & 5 deletions src/main.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# SPDX-License-Identifier: MIT

@static if VERSION >= v"1.8"
errno::Cint = 0
else
errno = 0
end
# Return code of main
errno::Cint = 0

# Check whether we are compiling with juliac
using Preferences: @load_preference
Expand Down
64 changes: 29 additions & 35 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -627,24 +627,22 @@ 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"
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
# 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"
# 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"
Expand Down Expand Up @@ -768,9 +766,7 @@ end
@test format_string("a $(d)+\n$(sp)b") == "a $(d)+\n b"
@test format_string("a $(d)+ b $(d)*\n$(sp)c") == "a $(d)+ b $(d)*\n c"
@test format_string("a $(d)+\n$(sp)b $(d)*\n$(sp)c") == "a $(d)+\n b $(d)*\n c"
if !(VERSION < v"1.7" && d == ".")
@test format_string("a $(d)||\n$(sp)b") == "a $(d)||\n b"
end
@test format_string("a $(d)||\n$(sp)b") == "a $(d)||\n b"
end
# assignment
for nl in ("\n", "\n\n")
Expand Down Expand Up @@ -1070,20 +1066,18 @@ end
# try-finally-catch(err)-end
@test format_string("try$(d)x$(d)finally$(d)y$(d)catch err$(d)z$(d)end") ==
"try\n x\nfinally\n y\ncatch err\n z\nend"
if VERSION >= v"1.8"
# try-catch-else-end
@test format_string("try$(d)x$(d)catch\ny$(d)else$(d)z$(d)end") ==
"try\n x\ncatch\n y\nelse\n z\nend"
# try-catch(err)-else-end
@test format_string("try$(d)x$(d)catch err$(d)y$(d)else$(d)z$(d)end") ==
"try\n x\ncatch err\n y\nelse\n z\nend"
# try-catch-else-finally-end
@test format_string("try$(d)x$(d)catch\ny$(d)else$(d)z$(d)finally$(d)z$(d)end") ==
"try\n x\ncatch\n y\nelse\n z\nfinally\n z\nend"
# try-catch(err)-else-finally-end
@test format_string("try$(d)x$(d)catch err$(d)y$(d)else$(d)z$(d)finally$(d)z$(d)end") ==
"try\n x\ncatch err\n y\nelse\n z\nfinally\n z\nend"
end
# try-catch-else-end
@test format_string("try$(d)x$(d)catch\ny$(d)else$(d)z$(d)end") ==
"try\n x\ncatch\n y\nelse\n z\nend"
# try-catch(err)-else-end
@test format_string("try$(d)x$(d)catch err$(d)y$(d)else$(d)z$(d)end") ==
"try\n x\ncatch err\n y\nelse\n z\nend"
# try-catch-else-finally-end
@test format_string("try$(d)x$(d)catch\ny$(d)else$(d)z$(d)finally$(d)z$(d)end") ==
"try\n x\ncatch\n y\nelse\n z\nfinally\n z\nend"
# try-catch(err)-else-finally-end
@test format_string("try$(d)x$(d)catch err$(d)y$(d)else$(d)z$(d)finally$(d)z$(d)end") ==
"try\n x\ncatch err\n y\nelse\n z\nfinally\n z\nend"
# do-end
@test format_string("open() do\na$(d)end") == "open() do\n a\nend"
@test format_string("open() do\nend") == "open() do\nend"
Expand Down

0 comments on commit 500ba09

Please sign in to comment.