Browse code

Add test for user input coming before choices read

John Hawthorn authored on 17/06/2018 18:48:06
Showing 1 changed files

... ...
@@ -320,6 +320,13 @@ class FzyTest < Minitest::Test
320 320
     @tty.assert_matches "> foo\nfoo"
321 321
   end
322 322
 
323
+  # https://github.com/jhawthorn/fzy/issues/81
324
+  def test_slow_stdin_fast_user
325
+    @tty = TTYtest.new_terminal(%{(echo aa; echo bc; echo bd; sleep 0.5) | #{FZY_PATH}})
326
+    @tty.send_keys("b\r")
327
+    @tty.assert_matches "bc"
328
+  end
329
+
323 330
   def test_help
324 331
     @tty = TTYtest.new_terminal(%{#{FZY_PATH} --help})
325 332
     @tty.assert_matches <<TTY