diff --git a/appveyor.yml b/appveyor.yml index 7c09cd5..d2f3ae6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ environment: matrix: + - julia_version: 1.0 - julia_version: 1 - - julia_version: 1.1 - julia_version: nightly platform: diff --git a/test/interpret_ui.jl b/test/interpret_ui.jl index c1c8322..ee4eea3 100644 --- a/test/interpret_ui.jl +++ b/test/interpret_ui.jl @@ -1,14 +1,70 @@ # This was copied from Debugger.jl and then modified -using TerminalRegressionTests, Rebugger, Revise +using TerminalRegressionTests, Rebugger, Revise, CodeTracking using HeaderREPLs, REPL using Test +includet("my_gcd.jl") + function run_terminal_test(cmd, validation, commands) + function compare_replace(em, target; replace=nothing) + # Compare two buffer, skipping over the equivalent of key=>rep replacement + # However, because of potential differences in wrapping we don't explicitly + # perform the replacement; instead, we make the comparison tolerant of difference + # `\n`. + buf = IOBuffer() + decoratorbuf = IOBuffer() + TerminalRegressionTests.VT100.dump(buf, decoratorbuf, em) + outbuf = take!(buf) + success = true + if replace !== nothing + output = String(outbuf) + key, rep = replace + idxkey = findfirst(key, target) + iout, itgt = firstindex(output), firstindex(target) + outlast, tgtlast = lastindex(output), lastindex(target) + lrep = length(rep) + while success && iout <= outlast && itgt <= tgtlast + if itgt == first(idxkey) + itgt += length(key) + for c in rep + cout = output[iout] + while c != cout && cout == '\n' + iout = nextind(output, iout) + cout = output[iout] + end + if c != cout + success = false + break + end + iout = nextind(output, iout) + end + else + cout, ctgt = output[iout], target[itgt] + success = cout == ctgt + iout, itgt = nextind(output, iout), nextind(target, itgt) + end + end + success && iout > outlast && itgt > tgtlast && return true + end + outbuf == codeunits(target) && return true + open("failed.out","w") do f + write(f, output) + end + open("expected.out","w") do f + write(f, target) + end + error("Test failed. Expected result written to expected.out, + actual result written to failed.out") + end + dirpath = joinpath(@__DIR__, "ui", "v$(VERSION.major).$(VERSION.minor)") isdir(dirpath) || mkpath(dirpath) filepath = joinpath(dirpath, validation) - TerminalRegressionTests.automated_test(filepath, commands) do emuterm + # Fix the path of gcd to match the current running version of Julia + gcdfile, gcdline = whereis(@which my_gcd(10, 20)) + cmp(a, b, decorator) = compare_replace(a, b; replace="****" => gcdfile*':'*string(gcdline)) + TerminalRegressionTests.automated_test(cmp, filepath, commands) do emuterm # TerminalRegressionTests.create_automated_test(filepath, commands) do emuterm main_repl = REPL.LineEditREPL(emuterm, true) main_repl.interface = REPL.setup_interface(main_repl) @@ -25,8 +81,6 @@ function run_terminal_test(cmd, validation, commands) end end -includet("my_gcd.jl") - CTRL_C = "\x3" EOT = "\x4" UP_ARROW = "\e[A" diff --git a/test/ui/v1.2/gcd.multiout b/test/ui/v1.2/gcd.multiout index e388388..3007a0d 100644 --- a/test/ui/v1.2/gcd.multiout +++ b/test/ui/v1.2/gcd.multiout @@ -1,7 +1,7 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++ |gcd(10, 20) |gcd(a::T, b::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt1 -|6, UInt32, UInt64, UInt8} in Base at /home/tim/src/julia-1/base/intfuncs.jl:31 +|6, UInt32, UInt64, UInt8} in Base at **** | a = 10 | b = 20 | T = Int64 @@ -12,8 +12,8 @@ | -------------------------------------------------- |AAAAAAAAAAA -|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAA |AAAAAAAA |AAAAAAAAAAA diff --git a/test/ui/v1.2/gcdsc.multiout b/test/ui/v1.2/gcdsc.multiout index 4bfe4b8..e7adc91 100644 --- a/test/ui/v1.2/gcdsc.multiout +++ b/test/ui/v1.2/gcdsc.multiout @@ -1,7 +1,7 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++ |__gcdval__ = gcd(10, 20); |gcd(a::T, b::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt1 -|6, UInt32, UInt64, UInt8} in Base at /home/tim/src/julia-1/base/intfuncs.jl:31 +|6, UInt32, UInt64, UInt8} in Base at **** | a = 10 | b = 20 | T = Int64 @@ -12,8 +12,8 @@ | -------------------------------------------------- |AAAAAAAAAAAAAAAAAAAAAAAAA -|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAA |AAAAAAAA |AAAAAAAAAAA diff --git a/test/ui/v1.3/gcd.multiout b/test/ui/v1.3/gcd.multiout index 31bbd61..c63ae7f 100644 --- a/test/ui/v1.3/gcd.multiout +++ b/test/ui/v1.3/gcd.multiout @@ -1,8 +1,7 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++ |my_gcd(10, 20) |my_gcd(a::T, b::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UI -|nt16, UInt32, UInt64, UInt8} in Main at /home/tim/.julia/dev/Rebugger/test/my_gc -|d.jl:4 +|nt16, UInt32, UInt64, UInt8} in Main at **** | a = 10 | b = 20 | T = Int64 @@ -23,4 +22,4 @@ |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -| \ No newline at end of file +| diff --git a/test/ui/v1.3/gcdsc.multiout b/test/ui/v1.3/gcdsc.multiout index 72d121c..fcb9df2 100644 --- a/test/ui/v1.3/gcdsc.multiout +++ b/test/ui/v1.3/gcdsc.multiout @@ -1,8 +1,7 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++ |__gcdval__ = my_gcd(10, 20); |my_gcd(a::T, b::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UI -|nt16, UInt32, UInt64, UInt8} in Main at /home/tim/.julia/dev/Rebugger/test/my_gc -|d.jl:4 +|nt16, UInt32, UInt64, UInt8} in Main at **** | a = 10 | b = 20 | T = Int64 @@ -23,4 +22,4 @@ |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -| \ No newline at end of file +| diff --git a/test/ui/v1.5/gcd.multiout b/test/ui/v1.5/gcd.multiout index 31bbd61..c63ae7f 100644 --- a/test/ui/v1.5/gcd.multiout +++ b/test/ui/v1.5/gcd.multiout @@ -1,8 +1,7 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++ |my_gcd(10, 20) |my_gcd(a::T, b::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UI -|nt16, UInt32, UInt64, UInt8} in Main at /home/tim/.julia/dev/Rebugger/test/my_gc -|d.jl:4 +|nt16, UInt32, UInt64, UInt8} in Main at **** | a = 10 | b = 20 | T = Int64 @@ -23,4 +22,4 @@ |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -| \ No newline at end of file +| diff --git a/test/ui/v1.5/gcdsc.multiout b/test/ui/v1.5/gcdsc.multiout index 72d121c..fcb9df2 100644 --- a/test/ui/v1.5/gcdsc.multiout +++ b/test/ui/v1.5/gcdsc.multiout @@ -1,8 +1,7 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++ |__gcdval__ = my_gcd(10, 20); |my_gcd(a::T, b::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UI -|nt16, UInt32, UInt64, UInt8} in Main at /home/tim/.julia/dev/Rebugger/test/my_gc -|d.jl:4 +|nt16, UInt32, UInt64, UInt8} in Main at **** | a = 10 | b = 20 | T = Int64 @@ -23,4 +22,4 @@ |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -| \ No newline at end of file +|