Browse code

Fix acceptance tests

John Hawthorn authored on 09/09/2018 20:31:40
Showing 1 changed files

... ...
@@ -328,7 +328,11 @@ class FzyTest < Minitest::Test
328 328
 
329 329
   # https://github.com/jhawthorn/fzy/issues/81
330 330
   def test_slow_stdin_fast_user
331
-    @tty = TTYtest.new_terminal(%{(echo aa; echo bc; echo bd; sleep 0.5) | #{FZY_PATH}})
331
+    @tty = TTYtest.new_terminal(%{(sleep 0.5; echo aa; echo bc; echo bd) | #{FZY_PATH}})
332
+
333
+    # Before input has all come in, but wait for fzy to at least start
334
+    sleep 0.1
335
+
332 336
     @tty.send_keys("b\r")
333 337
     @tty.assert_matches "bc"
334 338
   end
... ...
@@ -463,7 +467,7 @@ TTY
463 467
   def interactive_fzy(input: [], before: nil, after: nil, args: "")
464 468
     cmd = []
465 469
     cmd << %{echo "#{before}"} if before
466
-    cmd << %{echo -n "#{input.join("\\n")}" | #{FZY_PATH} #{args}}
470
+    cmd << %{printf "#{input.join("\\n")}" | #{FZY_PATH} #{args}}
467 471
     cmd << %{echo "#{after}"} if after
468 472
     cmd = cmd.join("; ")
469 473
     TTYtest.new_terminal(cmd)