From 951d46cc53384a30b70bc3ebaf59c72011741fc8 Mon Sep 17 00:00:00 2001 From: Amerlyq Date: Sun, 13 Dec 2015 05:39:42 +0200 Subject: [PATCH] QA: fixtures refined, splitted and isolated - Also separated testcase for partial/whole match - AgGroup tests wasn't touched Closed #29 Ref #49 --- t/ag-cmdline.vader | 46 ++++-------- t/ag-cmdline/option | 4 + t/ag-cmdline/space | 2 + t/ag-empty.vader | 16 ++-- t/ag-empty/space | 2 + t/ag-partial.vader | 120 ++++++++++++++++++++++++++++++ t/ag-partial/partial | 9 +++ t/ag-paths.vader | 11 ++- t/ag-paths/partial | 3 + t/{fixture => grp-all}/sample.vim | 0 10 files changed, 169 insertions(+), 44 deletions(-) create mode 100644 t/ag-cmdline/option create mode 100644 t/ag-cmdline/space create mode 100644 t/ag-empty/space create mode 100644 t/ag-partial.vader create mode 100644 t/ag-partial/partial create mode 100644 t/ag-paths/partial rename t/{fixture => grp-all}/sample.vim (100%) diff --git a/t/ag-cmdline.vader b/t/ag-cmdline.vader index 5b2dee6b..8211a664 100644 --- a/t/ag-cmdline.vader +++ b/t/ag-cmdline.vader @@ -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: diff --git a/t/ag-cmdline/option b/t/ag-cmdline/option new file mode 100644 index 00000000..6e37097d --- /dev/null +++ b/t/ag-cmdline/option @@ -0,0 +1,4 @@ +caSeIGnoRe +_o_part_only +re.*x +re.*x_ diff --git a/t/ag-cmdline/space b/t/ag-cmdline/space new file mode 100644 index 00000000..4e2e1765 --- /dev/null +++ b/t/ag-cmdline/space @@ -0,0 +1,2 @@ +singleword +multi word diff --git a/t/ag-empty.vader b/t/ag-empty.vader index 1234cb31..89191fb7 100644 --- a/t/ag-empty.vader +++ b/t/ag-empty.vader @@ -7,24 +7,24 @@ Execute (::Hold cwd fixture): cd fixture ================================ -Given (cword): - bazz +Given (Current ): + single -Do (Empty): +Do (Empty in NORMAL): :Ag\ 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:\Ag\ Expect (1 file, 1 match): - sample.vim|3 col 16| let fuga = 'bazz' + space|2 col 1| multi word ================================ Before: diff --git a/t/ag-empty/space b/t/ag-empty/space new file mode 100644 index 00000000..4e2e1765 --- /dev/null +++ b/t/ag-empty/space @@ -0,0 +1,2 @@ +singleword +multi word diff --git a/t/ag-partial.vader b/t/ag-partial.vader new file mode 100644 index 00000000..5a432f0d --- /dev/null +++ b/t/ag-partial.vader @@ -0,0 +1,120 @@ +""" check Ag -w for word bounds += :Ag regex += :Ag regex [..] += :Ag [..] regex += :Ag [..] regex [..] + +================================ +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 .. diff --git a/t/ag-partial/partial b/t/ag-partial/partial new file mode 100644 index 00000000..5f0e675a --- /dev/null +++ b/t/ag-partial/partial @@ -0,0 +1,9 @@ +"singlewhole" +singleleft_ +_singleright +_singlecenter_ + +"multi whole" +"multi left_ +_multi right" +_multi center_ diff --git a/t/ag-paths.vader b/t/ag-paths.vader index 2ce2f08e..83acbdca 100644 --- a/t/ag-paths.vader +++ b/t/ag-paths.vader @@ -3,14 +3,13 @@ = :Ag [..] 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) ================================ diff --git a/t/ag-paths/partial b/t/ag-paths/partial new file mode 100644 index 00000000..cd0c3d59 --- /dev/null +++ b/t/ag-paths/partial @@ -0,0 +1,3 @@ +"word a" +b word_ +c(word) diff --git a/t/fixture/sample.vim b/t/grp-all/sample.vim similarity index 100% rename from t/fixture/sample.vim rename to t/grp-all/sample.vim