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
4c3ae847
Commit
4c3ae847
authored
10 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Add test case for --with-nth + --multi
parent
5c0dc79f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_go.rb
+28
-2
28 additions, 2 deletions
test/test_go.rb
with
28 additions
and
2 deletions
test/test_go.rb
+
28
−
2
View file @
4c3ae847
...
...
@@ -124,7 +124,7 @@ class TestGoFZF < MiniTest::Unit::TestCase
assert_equal
'hello'
,
File
.
read
(
tempname
).
chomp
end
def
test_
fzf_prompt
def
test_
key_bindings
tmux
.
send_keys
"fzf -q 'foo bar foo-bar'"
,
:Enter
tmux
.
until
{
|
lines
|
lines
.
last
=~
/^>/
}
...
...
@@ -190,7 +190,7 @@ class TestGoFZF < MiniTest::Unit::TestCase
tmux
.
close
end
def
test_
fzf_
multi_order
def
test_multi_order
tmux
.
send_keys
"seq 1 10 | fzf --multi >
#{
tempname
}
"
,
:Enter
tmux
.
until
{
|
lines
|
lines
.
last
=~
/^>/
}
...
...
@@ -202,5 +202,31 @@ class TestGoFZF < MiniTest::Unit::TestCase
assert_equal
%w[3 2 5 6 8 7]
,
File
.
read
(
tempname
).
split
(
$/
)
tmux
.
close
end
def
test_with_nth
[
true
,
false
].
each
do
|
multi
|
tmux
.
send_keys
"(echo ' 1st 2nd 3rd/';
echo ' first second third/') |
fzf
#{
"--multi"
if
multi
}
-x --nth 2 --with-nth 2,-1,1 >
#{
tempname
}
"
,
:Enter
tmux
.
until
{
|
lines
|
lines
[
-
2
]
&&
lines
[
-
2
].
include?
(
'2/2'
)
}
# Transformed list
lines
=
tmux
.
capture
assert_equal
' second third/first'
,
lines
[
-
4
]
assert_equal
'> 2nd 3rd/1st'
,
lines
[
-
3
]
# However, the output must not be transformed
if
multi
tmux
.
send_keys
:BTab
,
:BTab
,
:Enter
assert_equal
[
' 1st 2nd 3rd/'
,
' first second third/'
],
File
.
read
(
tempname
).
split
(
$/
)
else
tmux
.
send_keys
'^'
,
'3'
tmux
.
until
{
|
lines
|
lines
[
-
2
].
include?
(
'1/2'
)
}
tmux
.
send_keys
:Enter
assert_equal
[
' 1st 2nd 3rd/'
],
File
.
read
(
tempname
).
split
(
$/
)
end
end
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