-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorganise tests, dropping Mocking.jl
- Loading branch information
Showing
9 changed files
with
164 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ authors = ["Lyndon White <[email protected]>"] | |
Cassette = "7057c7e9-c182-5462-911a-8362d720325c" | ||
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" | ||
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" | ||
Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533" | ||
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" | ||
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,22 @@ | ||
#== | ||
Note to test implementers: | ||
- For _reasons_, all user interaction test must go in this file | ||
- They can't be `include`ed AFIACT, or the mocks miss some-how. | ||
- All other tests should go in `run_non_ui_tests.jl` | ||
which is included in bottom of this file. | ||
In this file of User Interaction Tests: | ||
- All tests go in their own module so that breakpoints can't leak | ||
- They can not leak because the examples functions we break on are | ||
reincluded anew in each module, thus giving them distinct identity. | ||
- Do not set breakpoiints inside the apply do block. This is an anon function. | ||
Which for some reason makes #256 style bugs more likely. | ||
- The setup_ui_test_module.jl file defines things that each test module needs | ||
==# | ||
|
||
module CanHaveNoBreakpoints | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
p_readline = make_readline_patch([]) | ||
p_breadcrumbs, record = make_recording_breakpoint_hit_patch() | ||
|
||
apply([p_readline, p_breadcrumbs]) do | ||
@iron_debug eg1() | ||
end | ||
@test record == [] | ||
using MagneticReadHead | ||
using Test | ||
|
||
test_files = ( | ||
"test_ui.jl", | ||
"test_behavour.jl", | ||
"test_breadcrumbs.jl", | ||
"test_breakpoint_rules.jl", | ||
"test_inner_repl.jl", | ||
"test_locate.jl", | ||
"test_method_utils.jl", | ||
"test_utils.jl", | ||
"test_pass.jl", | ||
"test_variable_capture.jl", | ||
) | ||
|
||
@testset "MagneticReadHead" begin | ||
@testset "$file" for file in test_files | ||
include(file) | ||
end | ||
end | ||
|
||
|
||
|
||
module CanHave1Breakpoint | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
p_readline = make_readline_patch(["CC"]) | ||
p_breadcrumbs, record = make_recording_breakpoint_hit_patch() | ||
|
||
set_breakpoint!(eg2) | ||
apply([p_readline, p_breadcrumbs]) do | ||
@iron_debug eg1() | ||
end | ||
@test first(record).f == eg2 | ||
end | ||
end | ||
|
||
module CanHave2Breakpoints | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
p_readline = make_readline_patch(["CC", "CC"]) | ||
p_breadcrumbs, record = make_recording_breakpoint_hit_patch() | ||
|
||
set_breakpoint!(eg2) | ||
set_breakpoint!(eg3) | ||
apply([p_readline, p_breadcrumbs]) do | ||
@iron_debug eg1() | ||
end | ||
@test first.(record) == [eg2, eg3] | ||
end | ||
end | ||
|
||
######################################################### | ||
# Stepping Mode | ||
|
||
module CanHave1BreakpointThenStepInThenContinue | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
p_readline = make_readline_patch(["SI", "CC"]) | ||
p_breadcrumbs, record = make_recording_breakpoint_hit_patch() | ||
|
||
set_breakpoint!(eg2) | ||
apply([p_readline, p_breadcrumbs]) do | ||
@iron_debug eg1() | ||
end | ||
@test first.(record) == [eg2, eg21] | ||
end | ||
end | ||
|
||
|
||
############################################### | ||
module CanInfluenceCallingEnviroment | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
global zzz = 10 | ||
|
||
patch = make_readline_patch(["zzz = 20", "CC"]) | ||
|
||
set_breakpoint!(eg2) | ||
apply(patch) do | ||
@iron_debug eg1() | ||
end | ||
@test zzz==20 | ||
end | ||
end | ||
|
||
|
||
module Abort | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
patch = make_readline_patch(["XX"]) | ||
|
||
set_breakpoint!(eg2) | ||
apply(patch) do | ||
@test nothing==@iron_debug eg1() | ||
end | ||
end | ||
end | ||
|
||
|
||
######################################### | ||
|
||
println("\n**************************************************") | ||
include("run_non_ui_tests.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#== | ||
In this file of User Interaction Tests: | ||
- All tests go in their own module so that breakpoints can't leak | ||
- They can not leak because the examples functions we break on are | ||
reincluded anew in each module, thus giving them distinct identity. | ||
- The setup_ui_test_module.jl file defines things that each test module needs | ||
==# | ||
|
||
module CanHaveNoBreakpoints | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
make_readline_patch([]) | ||
record = make_recording_breakpoint_hit_patch() | ||
|
||
@iron_debug eg1() | ||
@test record == [] | ||
end | ||
end | ||
|
||
module CanHave1Breakpoint | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
make_readline_patch(["CC"]) | ||
record = make_recording_breakpoint_hit_patch() | ||
|
||
set_breakpoint!(eg2) | ||
@iron_debug eg1() | ||
@test first(record).f == eg2 | ||
end | ||
end | ||
|
||
module CanHave2Breakpoints | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" 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 | ||
end | ||
|
||
######################################################### | ||
# Stepping Mode | ||
|
||
module CanHave1BreakpointThenStepInThenContinue | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
make_readline_patch(["SI", "CC"]) | ||
record = make_recording_breakpoint_hit_patch() | ||
|
||
set_breakpoint!(eg2) | ||
@iron_debug eg1() | ||
@test first.(record) == [eg2, eg21] | ||
end | ||
end | ||
|
||
|
||
############################################### | ||
module CanInfluenceCallingEnviroment | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
global zzz = 10 | ||
make_readline_patch(["zzz = 20", "CC"]) | ||
|
||
set_breakpoint!(eg2) | ||
@iron_debug eg1() | ||
@test zzz==20 | ||
end | ||
end | ||
|
||
|
||
module Abort | ||
include("setup_ui_test_module.jl") | ||
|
||
@testset "$(@__MODULE__)" begin | ||
make_readline_patch(["XX"]) | ||
|
||
set_breakpoint!(eg2) | ||
@test nothing==@iron_debug eg1() | ||
end | ||
end | ||
|
||
|
||
include("setup_ui_test_module.jl") | ||
reset_patched_functions!() | ||
println("\tUser interaction tests complete") |