#!/bin/bash . "$TF_DIR/include/subtest.sh" . "$TF_DIR/include/tools.sh" tf_enum_subtests() { echo uri echo uris echo id echo ids echo exp echo exps echo tag echo tags echo kw echo kws echo mixed echo uris_in_lang } tf_do_subtest() { local t_name=$1 local t_in="test/$t_name.stdin" local o_out="oracle/$t_name.stdout" { echo " bz = http://bugzilla.example.com/?query=%s" echo " g = http://google.example.com/search?q=%s" echo " storage = ftp://joe:secret@storage%s.files.example.com/" echo " issue = http://gitlab.example.org/issue?id=%s" echo " faq = http://faq.example.org/faq/%s" } > test/example.map mkdata test > "$t_in" mkdata oracle > "$o_out" tf_testflt -i "$t_in" -n "$t_name" -O "$o_out" uripecker test/example.map } mkdata() { local what=$1 case $t_name:$what in uri:test) echo "http://distinct.uri1.example.com/" ;; uri:oracle) echo "http://distinct.uri1.example.com" ;; uris:test) echo "http://distinct.uri1.example.com/" echo "also http://distinct.uri2.example.com/get" echo "http://distinct.uri3.example.com/?x=1 as well" echo "then there's http://distinct.uri4.example.com/?x=1&y=2 as well" echo "and finally:" echo "http://distinct.uri5.example.com/get?x=1&y=2&foo=bar+%20+baz" ;; uris:oracle) echo "http://distinct.uri1.example.com" echo "http://distinct.uri2.example.com/get" echo "http://distinct.uri3.example.com/?x=1" echo "http://distinct.uri4.example.com/?x=1&y=2" echo "http://distinct.uri5.example.com/get?x=1&y=2&foo=bar+%20+baz" ;; id:test) echo "bz#123456789" ;; id:oracle) echo "http://bugzilla.example.com/?query=123456789" ;; ids:test) echo "bz#1" echo "also bz#2" echo "also bz#345 as well" echo "then there's bz#42 as well" echo "and finally:" echo "bz#6789" ;; ids:oracle) echo "http://bugzilla.example.com/?query=1" echo "http://bugzilla.example.com/?query=2" echo "http://bugzilla.example.com/?query=345" echo "http://bugzilla.example.com/?query=42" echo "http://bugzilla.example.com/?query=6789" ;; exp:test) echo "bz = 123456789" ;; exp:oracle) echo "http://bugzilla.example.com/?query=123456789" ;; exps:test) echo "bz = 1" echo "also bz = 2" echo "also bz = 345 as well" echo "then there's bz = 42 as well" echo "and finally:" echo "bz = 6789" ;; exps:oracle) echo "http://bugzilla.example.com/?query=1" echo "http://bugzilla.example.com/?query=2" echo "http://bugzilla.example.com/?query=345" echo "http://bugzilla.example.com/?query=42" echo "http://bugzilla.example.com/?query=6789" ;; tag:test) echo "bz123456789" ;; tag:oracle) echo "http://bugzilla.example.com/?query=123456789" ;; tags:test) echo "bz1" echo "bz345 as well" echo "and finally:" echo "bz6789" ;; tags:oracle) echo "http://bugzilla.example.com/?query=1" echo "http://bugzilla.example.com/?query=345" echo "http://bugzilla.example.com/?query=6789" ;; kw:test) echo "g foo" ;; kw:oracle) echo "http://google.example.com/search?q=foo" ;; kws:test) echo "g foo" echo "g bar" echo "g baz qux quux" echo "g learn 中文 in no time" ;; kws:oracle) echo "http://google.example.com/search?q=foo" echo "http://google.example.com/search?q=bar" echo "http://google.example.com/search?q=baz+qux+quux" echo "http://google.example.com/search?q=learn+%E4%B8%AD%E6%96%87+in+no+time" ;; mixed:test) echo "issue = 1" echo "http://other.example.com/" echo "faq#225" echo "https://secure.example.com/" echo "issue42" echo "https://secure.example.com/foo?id=2&name=bar+baz" echo "faq 14" echo "https://urlescape.example.com/foo?name=Jan%20%C5%A0varn%C3%BD%2C%20bytem%20%C5%98e%C4%8Dkovice%2017" echo "or faq 15" echo "http://anchor.example.org/foo/bar.html#baz" echo "ftp://joe:secret@files.example.com/" echo "storage 42" ;; mixed:oracle) echo "http://other.example.com" echo "https://secure.example.com" echo "https://secure.example.com/foo?id=2&name=bar+baz" echo "https://urlescape.example.com/foo?name=Jan%20%C5%A0varn%C3%BD%2C%20bytem%20%C5%98e%C4%8Dkovice%2017" echo "http://anchor.example.org/foo/bar.html#baz" echo "ftp://joe:secret@files.example.com" echo "http://faq.example.org/faq/225" echo "http://gitlab.example.org/issue?id=1" echo "http://gitlab.example.org/issue?id=42" echo "http://faq.example.org/faq/14" echo "ftp://joe:secret@storage42.files.example.com/" ;; uris_in_lang:test) echo 'Hello,' echo '' echo 'please download the new version here: https://build.example.com/new#build.' echo 'Full changelog can be found at release notes page(http://release.example.com/cl/v1.2.0) within few minutes.' echo echo 'Cheers,' echo 'Joe' echo '' echo '-- ' echo 'Joe the Builder' echo 'http://joe.example.com/joe#contact' ;; uris_in_lang:oracle) echo 'https://build.example.com/new#build' echo 'http://release.example.com/cl/v1.2.0' echo 'http://joe.example.com/joe#contact' ;; esac } mkdir -p test oracle tf_do_subtests