Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
2924fd3e
Commit
2924fd3e
authored
10 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Add regression test case for #91
parent
75b44aac
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fzf
+3
-2
3 additions, 2 deletions
fzf
test/test_fzf.rb
+16
-1
16 additions, 1 deletion
test/test_fzf.rb
with
19 additions
and
3 deletions
fzf
+
3
−
2
View file @
2924fd3e
...
...
@@ -366,7 +366,8 @@ class FZF
end
if
str
end
def
addstr_safe
str
C
.
addstr
str
.
gsub
(
"
\0
"
,
''
)
str
=
str
.
gsub
(
"
\0
"
,
''
)
rescue
str
C
.
addstr
str
end
def
print_input
...
...
@@ -1105,7 +1106,7 @@ class FZF
begin
unless
@delim
# AWK default
prefix_length
=
(
str
.
index
(
/\S/
)
rescue
0
)
||
0
prefix_length
=
(
str
.
index
(
/\S/
)
||
0
)
rescue
0
tokens
=
str
.
scan
(
/\S+\s*/
)
rescue
[]
else
prefix_length
=
0
...
...
This diff is collapsed.
Click to expand it.
test/test_fzf.rb
+
16
−
1
View file @
2924fd3e
...
...
@@ -5,6 +5,7 @@ require 'curses'
require
'timeout'
require
'stringio'
require
'minitest/autorun'
require
'tempfile'
$LOAD_PATH
.
unshift
File
.
expand_path
(
'../..'
,
__FILE__
)
ENV
[
'FZF_EXECUTABLE'
]
=
'0'
load
'fzf'
...
...
@@ -614,7 +615,7 @@ class TestFZF < MiniTest::Unit::TestCase
def
test_select_1_ambiguity
stream
=
stream_for
"Hello
\n
World"
begin
Timeout
::
timeout
(
3
)
do
Timeout
::
timeout
(
2
)
do
FZF
.
new
(
%w[--query=o --select-1]
,
stream
).
start
end
flunk
'Should not reach here'
...
...
@@ -681,5 +682,19 @@ class TestFZF < MiniTest::Unit::TestCase
# **[***** #] => [******# ]
assert_equal
[
true
,
0
,
6
],
fzf
.
constrain
(
2
,
10
,
7
,
10
)
end
def
test_invalid_utf8
tmp
=
Tempfile
.
new
(
'fzf'
)
tmp
<<
'hello '
<<
[
0xff
].
pack
(
'C*'
)
<<
' world'
<<
$/
<<
[
0xff
].
pack
(
'C*'
)
tmp
.
close
begin
Timeout
::
timeout
(
1
)
do
FZF
.
new
(
%w[-n..,1,2.. -q^ -x]
,
File
.
open
(
tmp
.
path
)).
start
end
rescue
Timeout
::
Error
end
ensure
tmp
.
unlink
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment