Add test for `fancyindex_hide_parent_dir on`

pull/110/head
kPherox 2018-10-15 14:41:01 +09:00 committed by Adrian Perez
parent 47ce20d993
commit fa13aef31b
3 changed files with 26 additions and 0 deletions

3
.gitignore vendored
View File

@ -2,3 +2,6 @@
/t/*.sh /t/*.sh
/t/*.out /t/*.out
/t/*.err /t/*.err
/t/pup*
/t/bug*/
/prefix/

23
t/06-hide_parent.test Normal file
View File

@ -0,0 +1,23 @@
#! /bin/bash
cat <<---
This test check the output using "fancyindex_hide_parent_dir on"
--
use pup
nginx_start 'fancyindex_hide_parent_dir on;'
content=$( fetch /child-directory/ )
# Check page title
[[ $(pup -p title text{} <<< "${content}") = "Index of /child-directory/" ]]
# Check table headers
[[ $(pup -n body table tbody tr:first-child td <<< "${content}") -eq 3 ]]
{
read -r name_label
read -r size_label
read -r date_label
} < <( pup -p body table tbody tr:first-child td text{} <<< "${content}" )
[[ ${name_label} != Parent\ Directory/ ]]
[[ ${name_label} = empty-file.txt ]]
[[ ${size_label} != - ]]
[[ ${date_label} != - ]]

View File