Skip to content
Myr

test_raw.rb

This file

Path

test/test_raw.rb

113 lines · 2.7 KiB · Ruby

Last changed by

Not known.

History of this file

Take it

1# frozen_string_literal: true23require_relative 'lib/common'45# Testing raw mode6class TestRaw < TestInteractive7  def test_raw_mode8    tmux.send_keys %(seq 1000 | #{FZF} --raw --bind ctrl-x:toggle-raw,a:enable-raw,b:disable-raw --gutter '▌' --multi --bind 'space:transform-prompt:echo "[[$FZF_RAW]] "'), :Enter9    tmux.until { assert_equal 1000, it.match_count }1011    tmux.send_keys 112    tmux.until { assert_equal 272, it.match_count }1314    tmux.send_keys :Up15    tmux.until { assert_includes it, '> 2' }1617    tmux.send_keys 'C-p'18    tmux.until do19      assert_includes it, '> 10'20      assert_includes it, '▖ 9'21    end2223    tmux.send_keys 'C-x'24    tmux.until do25      assert_includes it, '> 10'26      assert_includes it, '▌ 1'27    end2829    tmux.send_keys :Up, 'C-x'30    tmux.until do31      assert_includes it, '> 11'32      assert_includes it, '▖ 10'33    end3435    tmux.send_keys 136    tmux.until { assert_equal 28, it.match_count }3738    tmux.send_keys 'C-p'39    tmux.until do40      assert_includes it, '> 101'41      assert_includes it, '▖ 100'42    end4344    tmux.send_keys 'C-n'45    tmux.until do46      assert_includes it, '> 11'47      assert_includes it, '▖ 10'48    end4950    tmux.send_keys :Tab, :Tab, :Tab51    tmux.until { assert_equal 3, it.select_count }5253    tmux.send_keys 'C-x'54    tmux.until do55      assert_equal 1, it.select_count56      assert_includes it, '▌ 110'57      assert_includes it, '>>11'58    end5960    tmux.send_keys 'a'61    tmux.until do62      assert_equal 1, it.select_count63      assert_includes it, '>>11'64      assert_includes it, '▖ 10'65    end6667    tmux.send_keys :Down, :Space68    tmux.until { assert_includes it, '[[0]] 11' }6970    tmux.send_keys :Up, :Space71    tmux.until { assert_includes it, '[[1]] 11' }7273    tmux.send_keys 'b'74    tmux.until do75      assert_equal 1, it.select_count76      assert_includes it, '▌ 110'77      assert_includes it, '>>11'78    end7980    tmux.send_keys :Space81    tmux.until { assert_includes it, '[[]] 11' }8283    tmux.send_keys 'C-u', '5'84    tmux.until { assert_includes it, '> 5' }8586    tmux.send_keys 'C-x', 'C-p', 'C-p'87    tmux.until do88      assert_includes it, '> 25'89      assert_includes it, '▖ 24'90    end9192    tmux.send_keys 'C-x'93    tmux.until do94      assert_includes it, '> 25'95      assert_includes it, '▌ 15'96    end9798    # 35 is the closest match in raw mode99    tmux.send_keys 'C-x', :Up, :Up, :Up, :Up, :Up, :Up, 'C-x'100    tmux.until do101      assert_includes it, '> 35'102      assert_includes it, '▌ 25'103    end104  end105106  def test_raw_best107    tmux.send_keys %(seq 1000 | #{FZF} --raw --bind space:best), :Enter108    tmux.send_keys 999109    tmux.until { assert_includes it, '> 1' }110    tmux.send_keys :Space111    tmux.until { assert_includes it, '> 999' }112  end113end