ngx-awesomeindex/t/bug95-square-brackets.test

19 lines
614 B
Bash

#! /bin/bash
cat <<---
Bug #95: awesomeindex does not encode square brackets
https://github.com/aperezdc/ngx-awesomeindex/issues/95
--
use pup
# Prepare a directory with a file that contains square brackets in the name.
mkdir -p "${TESTDIR}/bug95"
touch "${TESTDIR}"/bug95/'bug[95].txt'
nginx_start
content=$(fetch /bug95/)
test -n "${content}" || fail 'Empty response'
expected_href='bug%5B95%5D.txt'
obtained_href=$(pup -p body tbody 'tr:nth-child(2)' a 'attr{href}' <<< "${content}")
test "${expected_href}" = "${obtained_href}" || \
fail 'Expected: %s - Obtained: %s' "${expected_href}" "${obtained_href}"