/
test_ui.jl
106 lines (81 loc) · 2.47 KB
/
test_ui.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
include("setup_ui_test_module.jl")
clear_breakpoints!(); clear_nodebugs!()
@testset "No breakpoints" begin
make_readline_patch([])
record = make_recording_breakpoint_hit_patch()
@iron_debug eg1()
@test record == []
end
clear_breakpoints!(); clear_nodebugs!()
@testset "1 breakpoint" begin
make_readline_patch(["CC"])
record = make_recording_breakpoint_hit_patch()
set_breakpoint!(eg2)
@iron_debug eg1()
@test first(record).f == eg2
end
clear_breakpoints!(); clear_nodebugs!()
@testset "Two breakpoints" begin
make_readline_patch(["CC", "CC"])
record = make_recording_breakpoint_hit_patch()
set_breakpoint!(eg2)
set_breakpoint!(eg3)
@iron_debug eg1()
@test first.(record) == [eg2, eg3]
end
###################################################
clear_breakpoints!(); clear_nodebugs!()
@testset "breakpoint by file and linenum" begin
make_readline_patch(["CC"])
record = make_recording_breakpoint_hit_patch()
# This doesn't work as demo.jl is not in a package.
set_breakpoint!("demo.jl", 9)
@test !isempty(list_breakpoints())
@iron_debug eg1()
@test first.(record) == [eg2]
end
#########################################################
# Stepping Mode
clear_breakpoints!(); clear_nodebugs!()
@testset "step in" begin
make_readline_patch(["SI", "CC"])
record = make_recording_breakpoint_hit_patch()
set_breakpoint!(eg2)
@iron_debug eg1()
@test first.(record) == [eg2, eg21]
end
clear_breakpoints!(); clear_nodebugs!()
@testset "step out" begin
set_breakpoint!(eg2)
make_readline_patch(["SO", "CC"])
record = make_recording_breakpoint_hit_patch()
@iron_debug eg1()
@test first.(record) == [eg2, eg1]
end
clear_breakpoints!(); clear_nodebugs!()
@testset "step next" begin
set_breakpoint!(eg2)
make_readline_patch(["SN", "SN", "CC"])
record = make_recording_breakpoint_hit_patch()
@iron_debug eg1()
@test first.(record) == [eg2, eg2, eg2]
end
###############################################
clear_breakpoints!(); clear_nodebugs!()
@testset "Influence calling enviroment" begin
global zzz = 10
make_readline_patch(["zzz = 20", "CC"])
set_breakpoint!(eg2)
@iron_debug eg1()
@test zzz==20
end
clear_breakpoints!(); clear_nodebugs!()
@testset "Abort" begin
make_readline_patch(["XX"])
set_breakpoint!(eg2)
@test nothing==@iron_debug eg1()
end
#######
# Done
reset_patched_functions!()
println("\tUser interaction tests complete")