URI: 
       coverage tests improvements - webdump_tests - Testfiles for webdump
  HTML git clone git://git.codemadness.org/webdump_tests
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
   DIR commit 955028dff826ed407db8e79b9362064df3913cd8
   DIR parent 48e2484a4d92a19af09d75f37ec61bcfe5cd9f1c
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Wed, 15 Jul 2026 12:25:23 +0200
       
       coverage tests improvements
       
       - test new OSC8 flag.
       - also check basic exit statuscode.
       - make a separate directory for input that should fail.
       
       Diffstat:
         M run_coverage.sh                     |      59 +++++++++++++++++++++++++------
         R tests/too_deep_nodes.html -> tests… |       0 
       
       2 files changed, 49 insertions(+), 10 deletions(-)
       ---
   DIR diff --git a/run_coverage.sh b/run_coverage.sh
       @@ -1,29 +1,40 @@
        #!/bin/sh
        bin="$HOME/p/webdump/webdump"
       +expectstatus="0"
        
        if ! test -x "$bin"; then
                echo "$bin must exist and executable" >&2
                exit 1
        fi
        
       +test_usage_fail() {
       +        cmd="$@"
       +        echo | "$bin" "$@" #2>/dev/null
       +        statuscode="$?"
       +        if test "$statuscode" = "0"; then
       +                echo "command should have failed but didn't: $bin $cmd" >&2
       +                exit 1
       +        fi
       +}
       +
        # must be an absolute URI
       -echo | "$bin" -b invalid 2>/dev/null
       +test_usage_fail -b invalid
        
        # invalid option
       -echo | "$bin" -X 2>/dev/null
       +test_usage_fail -X
        
        # invalid selector (too deep, > 32 nodes).
       -echo | "$bin" -s 'one,two,three,a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h' 2>/dev/null
       -echo | "$bin" -u 'one,two,three,a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h' 2>/dev/null
       +test_usage_fail -s 'one,two,three,a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h'
       +test_usage_fail -u 'one,two,three,a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h'
        
        # 256 byte limit per tag name, index, id and class.
       -echo | "$bin" -s 'a012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' 2>/dev/null
       -echo | "$bin" -s 'a.012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' 2>/dev/null
       -echo | "$bin" -s 'a#012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' 2>/dev/null
       -echo | "$bin" -s 'a@012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' 2>/dev/null
       +test_usage_fail -s 'a012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
       +test_usage_fail -s 'a.012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
       +test_usage_fail -s 'a#012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
       +test_usage_fail -s 'a@012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
        
        # invalid number for term width.
       -echo | "$bin" -w plop 2>/dev/null
       +test_usage_fail -w plop
        
        run() {
        #        # with crude timing information.
       @@ -36,7 +47,13 @@ run() {
        
                echo -n "running $bin $@ < $f" >&2
                "$bin" "$@" >/dev/null 2>/dev/null
       -        echo ": $?" >&2
       +        statuscode="$?"
       +        echo ": ${statuscode}" >&2
       +
       +        if test "$statuscode" != "$expectstatus"; then
       +                echo "FATAL"
       +                exit 1
       +        fi
        }
        
        runtests() {
       @@ -47,6 +64,7 @@ runtests() {
                run -l -i < "$f"
                run -l -r < "$f"
                run -l -i -r < "$f"
       +        run -l -i -r -a < "$f"
        
                run -b "$baseurl" -r < "$f"
                run -l -i -b "$baseurl" -r < "$f"
       @@ -78,6 +96,20 @@ runtests() {
                run -8 -d -a -I -l -i -x < "$f"
                run -8 -d -a -I -l -i -x -b "$baseurl" < "$f"
                run -x -s 'main' -a -l -i -b "$baseurl" < "$f"
       +
       +        # OSC8
       +        run -o < "$f"
       +        run -o -l < "$f"
       +        run -o -i -l < "$f"
       +        run -o -r -l < "$f"
       +        run -o -r -i -l < "$f"
       +        run -o -b "$baseurl" -r < "$f"
       +        run -o -l -i -b "$baseurl" -r < "$f"
       +        run -o -a -l -i -b "$baseurl" -r < "$f"
       +        run -o -a -l -i -b "$baseurl" < "$f"
       +        run -o -a -I -l -i -b "$baseurl" < "$f"
       +        run -o -8 -a -I -l -i -b "$baseurl" < "$f"
       +        run -o -8 -d -a -I -l -i -b "$baseurl" < "$f"
        }
        
        baseurl="http://codemadness.org/"
       @@ -99,3 +131,10 @@ file://host/path
        mysql://user@localhost:3306?get-server-public-key=true
        ftp://user:password@[2001:db8::7]:2121/rfc/rfc1808.txt?q=bla#abc@def
        !EOF
       +
       +# these should fail:
       +expectstatus="1"
       +baseurl="http://codemadness.org/"
       +for f in tests/shouldfail/*; do
       +        runtests "$baseurl" "$f"
       +done
   DIR diff --git a/tests/too_deep_nodes.html b/tests/shouldfail/too_deep_nodes.html