diff options
| author | 2014-01-15 06:25:45 (JST) | |
|---|---|---|
| committer | 2014-01-15 22:45:21 (JST) | |
| commit | caf557a2ba666ad87a1ebd5b40750feaf1bd631f (patch) | |
| tree | 8de9226af92266c06712bf4b480f19eb679c79a7 /tests/t0111-filter.sh | |
| parent | 8ae1d8b8fd0b097b10716d0d2d8acaadbd7a46f7 (diff) | |
| download | cgit-caf557a2ba666ad87a1ebd5b40750feaf1bd631f.zip cgit-caf557a2ba666ad87a1ebd5b40750feaf1bd631f.tar.gz | |
t0111: Add basic tests for Lua filters
* Validate the email filter by manipulating stdin. Additional checks for
  all the arguments can be added in a later patch.
* Add the exec prefix to all informational messages.
* Rename the filter repository to filter-exec. The Git repository itself
  is not renamed since it can be shared amongst all filter types.
* In the filter checks, check whether all arguments are passed properly
  instead of validating the buffer/stdin only.
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Diffstat (limited to 'tests/t0111-filter.sh')
| -rwxr-xr-x | tests/t0111-filter.sh | 65 | 
1 files changed, 34 insertions, 31 deletions
| diff --git a/tests/t0111-filter.sh b/tests/t0111-filter.sh index 2f99880..c89020a 100755 --- a/tests/t0111-filter.sh +++ b/tests/t0111-filter.sh | |||
| @@ -3,36 +3,39 @@ | |||
| 3 | test_description='Check filtered content' | 3 | test_description='Check filtered content' | 
| 4 | . ./setup.sh | 4 | . ./setup.sh | 
| 5 | 5 | ||
| 6 | test_expect_success 'generate filter/tree/a%2bb' ' | 6 | for prefix in exec lua | 
| 7 | cgit_url "filter/tree/a%2bb" >tmp | 7 | do | 
| 8 | ' | 8 | test_expect_success "generate filter-$prefix/tree/a%2bb" " | 
| 9 | 9 | cgit_url 'filter-$prefix/tree/a%2bb' >tmp | |
| 10 | test_expect_success 'check whether the source filter works' ' | 10 | " | 
| 11 | grep "<code>HELLO$" tmp | 11 | |
| 12 | ' | 12 | test_expect_success "check whether the $prefix source filter works" ' | 
| 13 | 13 | grep "<code>a+b HELLO$" tmp | |
| 14 | test_expect_success 'generate filter/about/' ' | 14 | ' | 
| 15 | cgit_url "filter/about/" >tmp | 15 | |
| 16 | ' | 16 | test_expect_success "generate filter-$prefix/about/" " | 
| 17 | 17 | cgit_url 'filter-$prefix/about/' >tmp | |
| 18 | test_expect_success 'check whether the about filter works' ' | 18 | " | 
| 19 | grep "<div id='"'"'summary'"'"'>HELLO$" tmp | 19 | |
| 20 | ' | 20 | test_expect_success "check whether the $prefix about filter works" ' | 
| 21 | 21 | grep "<div id='"'"'summary'"'"'>a+b HELLO$" tmp | |
| 22 | test_expect_success 'generate filter/commit/' ' | 22 | ' | 
| 23 | cgit_url "filter/commit/" >tmp | 23 | |
| 24 | ' | 24 | test_expect_success "generate filter-$prefix/commit/" " | 
| 25 | 25 | cgit_url 'filter-$prefix/commit/' >tmp | |
| 26 | test_expect_success 'check whether the commit filter works' ' | 26 | " | 
| 27 | grep "<div class='"'"'commit-subject'"'"'>ADD A+B" tmp | 27 | |
| 28 | ' | 28 | test_expect_success "check whether the $prefix commit filter works" ' | 
| 29 | 29 | grep "<div class='"'"'commit-subject'"'"'>ADD A+B" tmp | |
| 30 | test_expect_success 'check whether the email filter works for authors' ' | 30 | ' | 
| 31 | grep "<AUTHOR@EXAMPLE.COM>" tmp | 31 | |
| 32 | ' | 32 | test_expect_success "check whether the $prefix email filter works for authors" ' | 
| 33 | 33 | grep "A U THOR <AUTHOR@EXAMPLE.COM>" tmp | |
| 34 | test_expect_success 'check whether the email filter works for committers' ' | 34 | ' | 
| 35 | grep "<COMMITTER@EXAMPLE.COM>" tmp | 35 | |
| 36 | ' | 36 | test_expect_success "check whether the $prefix email filter works for committers" ' | 
| 37 | grep "C O MITTER <COMMITTER@EXAMPLE.COM>" tmp | ||
| 38 | ' | ||
| 39 | done | ||
| 37 | 40 | ||
| 38 | test_done | 41 | test_done | 
