@@ -4,6 +4,12 @@ import Pkg: PackageSpec
4
4
5
5
import BinaryBuilder. BinaryBuilderBase: available_gcc_builds, available_llvm_builds, getversion
6
6
7
+ # cursor movement in the terminal
8
+ const UP = " \e [A"
9
+ const DOWN = " \e [B"
10
+ const RGHT = " \e [C"
11
+ const LEFR = " \e [D"
12
+
7
13
function with_wizard_output (f:: Function , state, step_func:: Function )
8
14
# Create fake terminal to communicate with BinaryBuilder over
9
15
pty = VT100. create_pty (false )
@@ -156,14 +162,14 @@ end
156
162
157
163
state = Wizard. WizardState ()
158
164
with_wizard_output (state, Wizard. step1) do ins, outs
159
- call_response (ins, outs, " Make a platform selection" , " \e [B \r " )
160
- call_response (ins, outs, " Select operating systems" , " \e [B \r d" ; newline = false )
165
+ call_response (ins, outs, " Make a platform selection" , " $DOWN \r " )
166
+ call_response (ins, outs, " Select operating systems" , " $DOWN \r d" ; newline = false )
161
167
end
162
168
163
169
state = Wizard. WizardState ()
164
170
with_wizard_output (state, Wizard. step1) do ins, outs
165
- call_response (ins, outs, " Make a platform selection" , " \e [B \e [B \r " )
166
- call_response (ins, outs, " Select platforms" , " \e [B \r d" ; newline = false )
171
+ call_response (ins, outs, " Make a platform selection" , " $DOWN$DOWN \r " )
172
+ call_response (ins, outs, " Select platforms" , " $DOWN \r d" ; newline = false )
167
173
end
168
174
@test length (state. platforms) == 1
169
175
end
194
200
call_response (ins, outs, " Do you want to customize the set of compilers?" , " Y" )
195
201
call_response (ins, outs, " Select compilers for the project" , " ad" )
196
202
call_response (ins, outs, " Select the preferred GCC version" , " \r " )
197
- call_response (ins, outs, " Select the preferred LLVM version" , " \e [B \e [B \e [B \r " )
203
+ call_response (ins, outs, " Select the preferred LLVM version" , " $DOWN$DOWN$DOWN \r " )
198
204
end
199
205
# Check that the state is modified appropriately
200
206
@test state. source_urls == [" http://127.0.0.1:$(port) /a/source.tar.gz" ]
400
406
call_response (ins, outs, " Would you like to edit this script now?" , " N" )
401
407
402
408
# Clean environment
403
- call_response (ins, outs, " Return to build environment" , " \e [B \r " )
409
+ call_response (ins, outs, " Return to build environment" , " $DOWN \r " )
404
410
end
405
411
@test state. step === :step3
406
412
end
496
502
state = step5_state (" exit 1" )
497
503
with_wizard_output (state, state-> Wizard. step5_internal (state, first (state. platforms))) do ins, outs
498
504
call_response (ins, outs, " Press Enter to continue..." , " \n " )
499
- call_response (ins, outs, " How would you like to proceed?" , " \e [B \e [B \r " )
505
+ call_response (ins, outs, " How would you like to proceed?" , " $DOWN$DOWN \r " )
500
506
end
501
507
@test isempty (state. platforms)
502
508
end
549
555
# First, test local deployment
550
556
mktempdir () do out_dir
551
557
with_wizard_output (state, state-> Wizard. _deploy (state)) do ins, outs
552
- call_response (ins, outs, " How should we deploy this build recipe?" , " \e [B \r " )
558
+ call_response (ins, outs, " How should we deploy this build recipe?" , " $DOWN \r " )
553
559
call_response (ins, outs, " Enter directory to write build_tarballs.jl to:" , " $(out_dir) \r " )
554
560
end
555
561
@test isfile (joinpath (out_dir, " build_tarballs.jl" ))
559
565
# Next, test writing out to stdout
560
566
state = step7_state ()
561
567
with_wizard_output (state, state-> Wizard. _deploy (state)) do ins, outs
562
- call_response (ins, outs, " How should we deploy this build recipe?" , " \e [B \e [B \r " )
568
+ call_response (ins, outs, " How should we deploy this build recipe?" , " $DOWN$DOWN \r " )
563
569
@test readuntil_sift (outs, " Your generated build_tarballs.jl:" ) != = nothing
564
570
@test readuntil_sift (outs, " name = \" libfoo\" " ) != = nothing
565
571
@test readuntil_sift (outs, " make install" ) != = nothing
0 commit comments