Browse code

Add acceptance test for --show-scores

John Hawthorn authored on 08/02/2017 02:21:44
Showing 1 changed files

... ...
@@ -229,6 +229,22 @@ class FzyTest < Minitest::Test
229 229
     @tty.assert_matches "foo bar baz"
230 230
   end
231 231
 
232
+  def test_show_scores
233
+    expected_score = '(  inf)'
234
+    @tty = TTYtest.new_terminal(%{echo -n "foo\nbar" | #{FZY_PATH} -s})
235
+    @tty.send_keys('foo')
236
+    @tty.assert_matches "> foo\n#{expected_score} foo"
237
+
238
+    @tty = TTYtest.new_terminal(%{echo -n "foo\nbar" | #{FZY_PATH} --show-scores})
239
+    @tty.send_keys('foo')
240
+    @tty.assert_matches "> foo\n#{expected_score} foo"
241
+
242
+    expected_score = '( 0.89)'
243
+    @tty = TTYtest.new_terminal(%{echo -n "foo\nbar" | #{FZY_PATH} -s})
244
+    @tty.send_keys('f')
245
+    @tty.assert_matches "> f\n#{expected_score} foo"
246
+  end
247
+
232 248
   def test_help
233 249
     @tty = TTYtest.new_terminal(%{#{FZY_PATH} --help})
234 250
     @tty.assert_matches <<TTY