Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
QA: fixtures refined, splitted and isolated
Browse files Browse the repository at this point in the history
- Also separated testcase for partial/whole match
- AgGroup tests wasn't touched

Closed rking#29
Ref rking#49
  • Loading branch information
amerlyq authored and albfan committed Dec 17, 2015
1 parent 83ccaf9 commit 951d46c
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 44 deletions.
46 changes: 16 additions & 30 deletions t/ag-cmdline.vader
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,53 @@ Execute (::Hold cwd fixture):
cd fixture
=========== Spaces =============
Execute (Raw singleword):
Ag bazz
Ag singleword

Expect (1 file, 1 match):
sample.vim|3 col 16| let fuga = 'bazz'
space|1 col 1| singleword

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Quoted 'singleword'):
Ag 'bazz'
Ag 'singleword'

Expect (1 file, 1 match):
sample.vim|3 col 16| let fuga = 'bazz'
space|1 col 1| singleword

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Escaped multi\ word):
Ag let\ fuga
Ag multi\ word

Expect (1 file, 1 match):
sample.vim|3 col 4| let fuga = 'bazz'
space|2 col 1| multi word

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Quoted "multi word"):
Ag "let fuga"
Ag "multi word"

Expect (1 file, 1 match):
sample.vim|3 col 4| let fuga = 'bazz'
space|2 col 1| multi word


=========== Options ============
Execute (Whole -w singleword):
Ag -w bazz
Execute (Case-ignore -i caSeIGnoRe):
Ag -i ignore

Expect (1 file, 1 match):
sample.vim|3 col 16| let fuga = 'bazz'
option|1 col 5| caSeIGnoRe

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Whole -w 'multi word'):
Ag -w 'let fuga'
Execute (Matched-only -o _PART_only):
Ag -o part

Expect (1 file, 1 match):
sample.vim|3 col 4| let fuga = 'bazz'

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Case-ignore -i singleword):
Ag -i BAZZ

Expect (1 file, 1 match):
sample.vim|3 col 16| let fuga = 'bazz'

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Matched-only -o singleword):
Ag -o bazz

Expect (1 file, 1 match):
sample.vim|3 col 16| bazz
option|2 col 4| part

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Multiple flags -Q -w singleword):
Ag -Q -w bazz
Ag -Q -w 're.*x'

Expect (1 file, 1 match):
sample.vim|3 col 16| let fuga = 'bazz'
option|3 col 1| re.*x

================================
Before:
Expand Down
4 changes: 4 additions & 0 deletions t/ag-cmdline/option
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
caSeIGnoRe
_o_part_only
re.*x
re.*x_
2 changes: 2 additions & 0 deletions t/ag-cmdline/space
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
singleword
multi word
16 changes: 8 additions & 8 deletions t/ag-empty.vader
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
Execute (::Hold cwd fixture):
cd fixture
================================
Given (cword):
bazz
Given (Current <cword>):
single

Do (Empty):
Do (Empty in NORMAL):
:Ag\<CR>

Expect (1 file, 1 match):
sample.vim|3 col 16| let fuga = 'bazz'
space|1 col 1| singleword

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Given (cword):
bazz
Given (One word VSEL):
multi

Do (Empty):
Do (Empty in VISUAL):
viw:\<C-u>Ag\<CR>

Expect (1 file, 1 match):
sample.vim|3 col 16| let fuga = 'bazz'
space|2 col 1| multi word

================================
Before:
Expand Down
2 changes: 2 additions & 0 deletions t/ag-empty/space
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
singleword
multi word
120 changes: 120 additions & 0 deletions t/ag-partial.vader
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
""" check Ag -w for word bounds
= :Ag regex
= :Ag regex [<path>..]
= :Ag [<options>..] regex
= :Ag [<options>..] regex [<path>..]

================================
Execute (::Hold cwd fixture):
cd fixture
=========== Single =============
Execute (Match singlewhole):
Ag singlewhole

Expect (1 file, 1 match):
partial|1 col 2| "singlewhole"

Execute (Match -w singlewhole):
Ag -w singlewhole

Expect (1 file, 1 match):
partial|1 col 2| "singlewhole"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Match singleleft_):
Ag singleleft

Expect (1 file, 1 match):
partial|2 col 1| singleleft_

Execute (No match -w singleleft_):
Ag -w singleleft

Then (No matches):
Assert empty(getqflist())

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Match _singleright):
Ag singleright

Expect (1 file, 1 match):
partial|3 col 2| _singleright

Execute (No match -w _singleright):
Ag -w singleright

Then (No matches):
Assert empty(getqflist())

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Match _singlecenter_):
Ag singlecenter

Expect (1 file, 1 match):
partial|4 col 2| _singlecenter_

Execute (No match -w _singlecenter_):
Ag -w singlecenter

Then (No matches):
Assert empty(getqflist())


========== Multiple ============
Execute (Match multi whole):
Ag multi\ whole

Expect (1 file, 1 match):
partial|6 col 2| "multi whole"

Execute (Match -w multi whole):
Ag -w multi\ whole

Expect (1 file, 1 match):
partial|6 col 2| "multi whole"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Match multi left_):
Ag multi\ left

Expect (1 file, 1 match):
partial|7 col 2| "multi left_

Execute (No match -w multi left_):
Ag -w multi\ left

Then (No matches):
Assert empty(getqflist())

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Match _multi right):
Ag multi\ right

Expect (1 file, 1 match):
partial|8 col 2| _multi right"

Execute (No match -w _multi right):
Ag -w multi\ right

Then (No matches):
Assert empty(getqflist())

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute (Match _multi center_):
Ag multi\ center

Expect (1 file, 1 match):
partial|9 col 2| _multi center_

Execute (No match -w _multi center_):
Ag -w multi\ center

Then (No matches):
Assert empty(getqflist())


================================
Before:
After:
Execute (::Release fixture):
cd ..
9 changes: 9 additions & 0 deletions t/ag-partial/partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"singlewhole"
singleleft_
_singleright
_singlecenter_

"multi whole"
"multi left_
_multi right"
_multi center_
11 changes: 5 additions & 6 deletions t/ag-paths.vader
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
= :Ag [<options>..] regex path..

================================
Execute(Results in subdir):
Ag fuga fixture
Execute(Match in subdir):
Ag word fixture

Expect (1 path, 4 matches):
fixture/sample.vim|3 col 8| let fuga = 'bazz'
fixture/sample.vim|11 col 7| if fuga =~ 'z'
fixture/sample.vim|12 col 13| echo "fuga contains z"
fixture/sample.vim|14 col 13| echo 'fuga does not contains z'
fixture/partial|1 col 2| "word a"
fixture/partial|2 col 3| b word_
fixture/partial|3 col 3| c(word)


================================
Expand Down
3 changes: 3 additions & 0 deletions t/ag-paths/partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"word a"
b word_
c(word)
File renamed without changes.

0 comments on commit 951d46c

Please sign in to comment.