Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Move the mimetype file tests to the plain tests
Each now writes a types file and config of its own rather than
rewriting the one the test before it left.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0105-plain.sh | 23 | |
| -rwxr-xr-x | tests/t0303-robustness.sh | 22 |
2 files changed, 23 insertions, 22 deletions
diff --git a/tests/t0105-plain.sh b/tests/t0105-plain.sh index 68832da..e06ec96 100755 --- a/tests/t0105-plain.sh +++ b/tests/t0105-plain.sh @@ -209,4 +209,27 @@ test_expect_success 'a control character in a file name stays out of the headers grep "^Content-Disposition: inline; filename=.ctl?name.txt.$" tmp ' + +# A mime.types file gives an extension the type of the first line naming it, +# so a line naming nothing, or a comment naming the extension ahead of the +# real line, has to be passed over. Each test writes a file of its own. +test_expect_success 'set up a file whose type only a mimetype file knows' ' + test_create_repo repos/mime && + test_commit -C repos/mime --no-tag note note.cgt +' + +test_expect_success 'a blank line in the mimetype file is skipped' ' + printf "\n \nimage/x-cgit cgt\n" >blank.types && + cgitrc_repo blankrc mime "mimetype-file=$PWD/blank.types" && + cgit_ok blankrc "url=mime/plain/note.cgt" >tmp && + grep "^Content-Type: image/x-cgit$" tmp +' + +test_expect_success 'an indented comment in the mimetype file is skipped' ' + printf " # cgt used to be image/x-old\nimage/x-cgit cgt\n" >comment.types && + cgitrc_repo commentrc mime "mimetype-file=$PWD/comment.types" && + cgit_ok commentrc "url=mime/plain/note.cgt" >tmp && + grep "^Content-Type: image/x-cgit$" tmp +' + test_done diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index d9a8809..7fa06da 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -528,28 +528,6 @@ test_expect_success 'the fallback branch skips a name spelled like an option' ' test_grep ! "<option value=.-first." tmp ' -test_expect_success 'a blank line in the mimetype file is skipped' ' - ( - cd repos/rob && - echo note >note.cgt && - git add note.cgt && - git commit -m note - ) && - printf "\n \nimage/x-cgit cgt\n" >mime.types && - { - echo "mimetype-file=$PWD/mime.types" && - cat robrc - } >mimerc && - cgit_rc mimerc "url=rob/plain/note.cgt" >tmp && - grep "^Content-Type: image/x-cgit" tmp -' - -test_expect_success 'an indented comment in the mimetype file is skipped' ' - printf " # cgt used to be image/x-old\nimage/x-cgit cgt\n" >mime.types && - cgit_rc mimerc "url=rob/plain/note.cgt" >tmp && - grep "^Content-Type: image/x-cgit" tmp -' - # A cache that stored nothing would pass the first config whatever its ttl, # so a second keeps the same page for ever and has to show it unchanged. test_expect_success 'a refs page named with an id is not cached for ever' ' |
