/
runtests.jl
57 lines (49 loc) · 1.33 KB
/
runtests.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using DebuggerFramework
using Test
using REPL
using TerminalRegressionTests
include("languages/brainstack.jl")
include("languages/calc.jl")
function setup_repl(emuterm)
repl = REPL.LineEditREPL(emuterm, true)
repl.interface = REPL.setup_interface(repl)
repl.specialdisplay = REPL.REPLDisplay(repl)
repl
end
const thisdir = dirname(@__FILE__)
# Test stepping in/out of frames
# Language: BrainStack
proga = """
1: 2 3 0
2: 0
3: 0
"""
asta = parse(BrainStack.BrainStackAST, proga)
@test BrainStack.interpret(asta) == 2
TerminalRegressionTests.automated_test(
joinpath(thisdir,"brainstack/simple.multiout"),
["si\n", "f 2\n", "si\n", "si\n", "\n", "\n"]) do emuterm
DebuggerFramework.debug(asta, setup_repl(emuterm), emuterm)
end
# Test test entering language specific prompt
# Language: Calc
prog = """
1 + (9 * (7 / 2))
_1 * 2
_1 + _2
_1 / 3
"""
calc_code = Calc.parseall(prog)
TerminalRegressionTests.automated_test(
joinpath(thisdir,"calc/lsrp.multiout"),
[
# Evaluate the first three expressions
"s\ns\ns\n",
# Look at the first backref
"`_1\n\b",
# Make sure we can type ` without erroring (#2)
"abc`\b\b\b\b`_1\n",
# Exit
"\x4"]) do emuterm
DebuggerFramework.debug(calc_code, setup_repl(emuterm), emuterm)
end