#!/bin/sh # Checks what the configuration parser reports on stderr. test_description='Check configuration diagnostics' . ./setup.sh test_expect_success 'set up configs' ' cgitrc_repo diagrc diag no-such-key=1 "repo.path=$PWD/repos/foo/.git" repo.no-such-repo-key=1 && { echo "virtual-root=/" && echo "cache-size=0" && echo "repo.desc=early" && echo "repo.url=diag" && echo "repo.path=$PWD/repos/foo/.git" && echo "repo.readme=:file-1" && echo "repo.about-filter=exec:true" } >earlyrc ' test_expect_success 'unknown keys are reported and the page still renders' ' cgit_rc diagrc "url=diag/" >tmp 2>err && grep "Status: 200" tmp && grep "Unknown config key: no-such-key" err && grep "Unknown repo config key: no-such-repo-key" err ' test_expect_success 'a repo key before any repo.url is reported' ' cgit_rc earlyrc "url=diag/" >tmp 2>err && grep "Status: 200" tmp && grep "Ignoring repo.desc before any repo.url" err ' test_expect_success 'a filter in a scanned repository is reported without its flag' ' git clone -q --bare repos/foo/.git scan/foo.git && echo "commit-filter=exec:$FILTER_DIRECTORY/dump.sh" >scan/foo.git/cgitrc && { echo "virtual-root=/" && echo "cache-size=0" && echo "scan-path=$PWD/scan" } >scanrc && cgit_rc scanrc "url=foo.git/commit/" >tmp 2>err && grep "