invalid_decode.sh - sfeed_tests - sfeed tests and RSS and Atom files
 (HTM) git clone git://git.codemadness.org/sfeed_tests
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       invalid_decode.sh (827B)
       ---
            1 #!/bin/sh
            2 # test decoding a feed.
            3 # test invalid characters, invalid text-encoding names, etc.
            4 
            5 tmppath=$(mktemp -d)
            6 tmpfeed="/tmp/testfeed.$$"
            7 tmprc="/tmp/sfeedrc.$$"
            8 
            9 printf '\x80' > "${tmpfeed}"
           10 printf 'abc' > "${tmpfeed}2"
           11 printf 'abc' > "${tmpfeed}3" # OK
           12 printf '%s\n' '<?xml version="1.0" encoding="UTF-8"?>' > "${tmpfeed}4" # OK
           13 printf '%s\n' '<?xml version="1.0" encoding="UTF-69"?>' > "${tmpfeed}5"
           14 
           15 cat > "$tmprc" <<!__EOF__
           16 sfeedpath="$tmppath"
           17 
           18 feeds() {
           19         # feed <name> <url> [baseurl] [encoding]
           20         feed "testfeed" "file://$tmpfeed" "" "utf-16"
           21         feed "testfeed2" "file://${tmpfeed}2" "" "invalid-name"
           22         feed "testfeed3" "file://${tmpfeed}3"
           23         feed "testfeed4" "file://${tmpfeed}4"
           24         feed "testfeed5" "file://${tmpfeed}5" "" "utf-69" # override encoding, invalid name so should fail.
           25 }
           26 !__EOF__
           27 
           28 sfeed_update "$tmprc"