File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using REPL. TerminalMenus
2+
3+ function _test_scripts (test_dir:: AbstractString )
4+ scripts = filter (readdir (test_dir; join= false )) do name
5+ startswith (name, " test_" ) && endswith (name, " .jl" ) && isfile (joinpath (test_dir, name))
6+ end
7+ # Avoid offering this menu script itself to prevent accidental recursion.
8+ filter! (name -> name != basename (@__FILE__ ), scripts)
9+ sort! (scripts)
10+ return scripts
11+ end
12+
13+ function test_menu ()
14+ test_dir = @__DIR__
15+
16+ active = true
17+ while active
18+ scripts = _test_scripts (test_dir)
19+ if isempty (scripts)
20+ println (" No test scripts matching test_*.jl found in $(test_dir) ." )
21+ break
22+ end
23+
24+ options = vcat ([" include(\" $(name) \" )" for name in scripts], [" quit" ])
25+ menu = RadioMenu (options, pagesize= min (12 , length (options)))
26+ choice = request (" \n Choose test script to include or `q` to quit: " , menu)
27+
28+ if choice != - 1 && choice != length (options)
29+ include (joinpath (test_dir, scripts[choice]))
30+ else
31+ println (" Left menu. Press <ctrl><d> to quit Julia!" )
32+ active = false
33+ end
34+ end
35+ end
36+
37+ test_menu ()
You can’t perform that action at this time.
0 commit comments