Skip to content

Commit

Permalink
fix test on 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Mar 26, 2024
1 parent 2a1b3bc commit 03d06a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
MyterialColors = "1c23619d-4212-4747-83aa-717207fae70f"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
ProgressLogging = "33c8b6b6-d38a-422a-b730-caa89a2f386c"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
Expand All @@ -33,8 +33,8 @@ Markdown = "1"
MyterialColors = "0.3"
OrderedCollections = "1"
Parameters = "0.12"
ProgressLogging = "0.1"
PrecompileTools = "1"
ProgressLogging = "0.1"
REPL = "1"
Tables = "1"
UUIDs = "1"
Expand Down
2 changes: 1 addition & 1 deletion src/highlight.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function load_code_and_highlight(path::AbstractString, lineno::Int; δ::Int = 3)
code = split(join(code), "\n")

# clean
clean(line) = replace(line, " {/ }" => "", '\r' => "")
clean(line) = replace(replace(line, " {/ }" => ""), '\r' => "") # NOTE: julia `1.6` compat
codelines = clean.(code) # [10-δ:10+δ]
linenos = linenos # [10-δ:10+δ]

Expand Down
10 changes: 5 additions & 5 deletions test/19_test_repr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end
obj = Rocket(10, 50, 5000, "NASA")
@with_repr struct T end

VERSION v"1.7" && begin
if VERSION v"1.7"
IS_WIN || @compare_to_string sprint(termshow, obj) "repr_rocket"
IS_WIN || @compare_to_string sprint(termshow, T()) "repr_T_struct"
if VERSION v"1.10"
Expand All @@ -41,7 +41,7 @@ end

mts = MyTestStruct3("aa aa"^100, zeros(100, 100), 3, Panel(), "b b b"^100)

VERSION v"1.7" && begin
if VERSION v"1.7"
IS_WIN || @compare_to_string sprint(termshow, mts) "mts_repr"
end
end
Expand Down Expand Up @@ -90,22 +90,22 @@ else
)
end

VERSION v"1.10" && @testset "TERMSHOW for types" begin
v"1.7" VERSION v"1.10" && @testset "TERMSHOW for types" begin
for (i, t) in objs
t = sprint(sprint_termshow, t)
IS_WIN || @compare_to_string(t, "termshow_$i")
end
end

VERSION v"1.10" && @testset "Term automatic repr" begin
v"1.7" VERSION v"1.10" && @testset "Term automatic repr" begin
repr_show(io, x) = show(io, MIME("text/plain"), x)
@test sprint(repr_show, 1) == "\e[38;2;144;202;249m1\e[39m"

IS_WIN || @compare_to_string(sprint(repr_show, Dict(1 => :x)), "automatic_repr_1")
IS_WIN || @compare_to_string(sprint(repr_show, :(x + y)), "automatic_repr_2")
end

VERSION v"1.10" && @testset "@showme" begin
v"1.7" VERSION v"1.10" && @testset "@showme" begin
# fix for different path on remote CI
loc = "\e[2m/Users/federicoclaudi/Documents/Github/Term.jl/src/"
rem = " \e[2m/home/runner/work/Term.jl/Term.jl/src/"
Expand Down

0 comments on commit 03d06a7

Please sign in to comment.