Skip to content
Myr

Add regression test case for #91

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 75b44aa · Browse files · 2 files+19 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+19 added−3 removed

  • tests:+16 added−1 removed
  • other:+3 added−2 removed

2 files+19 added−3 removed

modified:test/test_fzf.rb+16 added-1 removed
3 unmodified lines
4require 'curses'5require 'timeout'6require 'stringio'7require 'minitest/autorun'8require 'tempfile'9$LOAD_PATH.unshift File.expand_path('../..', __FILE__)10ENV['FZF_EXECUTABLE'] = '0'11load 'fzf'12
601 unmodified lines
614615 def test_select_1_ambiguity616 stream = stream_for "Hello\nWorld"617 begin617 Timeout::timeout(3) do618 Timeout::timeout(2) do619 FZF.new(%w[--query=o --select-1], stream).start620 end621 flunk 'Should not reach here'622 rescue Exception => e
58 unmodified lines
681682 # **[***** #] => [******# ]683 assert_equal [true, 0, 6], fzf.constrain(2, 10, 7, 10)684 end685686 def test_invalid_utf8687 tmp = Tempfile.new('fzf')688 tmp << 'hello ' << [0xff].pack('C*') << ' world' << $/ << [0xff].pack('C*')689 tmp.close690 begin691 Timeout::timeout(1) do692 FZF.new(%w[-n..,1,2.. -q^ -x], File.open(tmp.path)).start693 end694 rescue Timeout::Error695 end696 ensure697 tmp.unlink698 end699end700
modified:fzf+3 added-2 removed
364 unmodified lines
365 addstr_safe str366 end if str367 end368 def addstr_safe str369 C.addstr str.gsub("\0", '')369 str = str.gsub("\0", '') rescue str370 C.addstr str371 end372373 def print_input374 C.setpos cursor_y, 0
730 unmodified lines
1105 @tokens_cache[str] ||=1106 begin1107 unless @delim1108 # AWK default1108 prefix_length = (str.index(/\S/) rescue 0)|| 01109 prefix_length = (str.index(/\S/) || 0) rescue 01110 tokens = str.scan(/\S+\s*/) rescue []1111 else1112 prefix_length = 01113 tokens = str.scan(@delim) rescue []
159 unmodified lines