Skip to content

Commit 6471471

Browse files
committed
fix tests
1 parent 7db71d2 commit 6471471

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/terminal.jl

+11-6
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ const keydict = Dict(:up => "\e[A",
2929
if isdefined(Base, :active_repl)
3030
@test Cthulhu.default_terminal() isa REPL.Terminals.TTYTerminal
3131
end
32-
colorize(use_color::Bool, c::Char) = Cthulhu.stringify() do io
33-
use_color ? printstyled(io, c; color=:cyan) : print(io, c)
32+
colorize(active_option::Bool, c::Char) = Cthulhu.stringify() do io
33+
active_option ? printstyled(io, c; color=:green) : printstyled(io, c; color=:red)
3434
end
35+
36+
colorize(s::AbstractString; color::Symbol = :cyan) = Cthulhu.stringify() do io
37+
printstyled(io, s; color)
38+
end
39+
3540
# Write a file that we track with Revise. Creating it programmatically allows us to rewrite it with
3641
# different content
3742
fn = tempname()
@@ -64,14 +69,14 @@ const keydict = Dict(:up => "\e[A",
6469
@test occursin('[' * colorize(true, 'o') * "]ptimize", lines)
6570
@test occursin('[' * colorize(true, 'T') * "]yped", lines)
6671

67-
@test occursin("\nSelect a call to descend into", lines) # beginning of the line
72+
@test occursin('\n' * colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color = :blue), lines) # beginning of the line
6873
@test occursin('', lines)
6974
write(in, 'o') # switch to unoptimized
7075
lines = cread(out)
7176
@test occursin("invoke simplef(::Float32,::Int32)::Float32", lines)
7277
@test occursin(r"\(z = a \* a\)\u001B\[\d\dm::Float32\u001B\[39m", lines)
7378
@test occursin('[' * colorize(false, 'o') * "]ptimize", lines)
74-
@test occursin("\nSelect a call to descend into", lines) # beginning of the line
79+
@test occursin('\n' * colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color = :blue), lines) # beginning of the line
7580
@test occursin("• %1 = *(::Float32,::Float32)::Float32", lines)
7681
# Call selection
7782
write(in, keydict[:down])
@@ -103,7 +108,7 @@ const keydict = Dict(:up => "\e[A",
103108
@test occursin(r"z.*::Float32", lines)
104109
@test occursin(r"\nBody.*Float32", lines)
105110
@test occursin('[' * colorize(true, 'w') * "]arn", lines)
106-
@test occursin("\nSelect a call to descend into", lines) # beginning of the line
111+
@test occursin('\n' * colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color = :blue), lines) # beginning of the line
107112
@test occursin("• %1 = *(::Float32,::Float32)::Float32", lines)
108113
# Source view
109114
write(in, 'S')
@@ -146,7 +151,7 @@ const keydict = Dict(:up => "\e[A",
146151
write(in, 'd'); cread(out)
147152
write(in, 'L')
148153
lines = cread(out)
149-
@test occursin('[' * colorize(false, 'd') * "]ebuginfo", lines)
154+
@test occursin("[d]ebuginfo", lines)
150155
@test !occursin("┌ @ promotion.jl", lines)
151156
# Native-code view
152157
write(in, 'N')

0 commit comments

Comments
 (0)