| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # Test the `guile-snarf' tool. |
| 4 | |
| 5 | # Strip the first line, like GNU `tail -n +2' does, but in a portable |
| 6 | # way (`tail' on Solaris 10 doesn't support `-n +2' for instance.) |
| 7 | strip_first_linescip-shell shell shell-project 0.0.0 strip_first_line(). () |
| 8 | { |
| 9 | read line |
| 10 | while read line |
| 11 | do |
| 12 | echoscip-shell system . . echo. "$line" |
| 13 | done |
| 14 | } |
| 15 | |
| 16 | snarfscip-shell shell shell-project 0.0.0 snarf(). () |
| 17 | { |
| 18 | # GNU cpp emits a comment on the first line, which shows what |
| 19 | # arguments it was passed. Strip this line. |
| 20 | echoscip-shell system . . echo. "$1" | guile-snarf - | strip_first_linescip-shell shell shell-project 0.0.0 strip_first_line(). | trscip-shell system . . tr. -d ' \t\n' |
| 21 | } |
| 22 | |
| 23 | snarf_testscip-shell shell shell-project 0.0.0 snarf_test(). () |
| 24 | { |
| 25 | x=`snarfscip-shell shell shell-project 0.0.0 snarf(). "$1"` |
| 26 | if [scip-shell system . . `[`. x"$x" != x"$2" ]; then |
| 27 | echoscip-shell system . . echo. "Incorrect output: expected \"$2\", but got \"$x\"" |
| 28 | exit 1 |
| 29 | fi |
| 30 | } |
| 31 | |
| 32 | snarf_testscip-shell shell shell-project 0.0.0 snarf_test(). "^^a^:^" "a;" |
| 33 | snarf_testscip-shell shell shell-project 0.0.0 snarf_test(). " ^ ^ b ^ : ^ " "b;" |
| 34 | snarf_testscip-shell shell shell-project 0.0.0 snarf_test(). "c\n^^d^:^\ne" "d;" |
| 35 | snarf_testscip-shell shell shell-project 0.0.0 snarf_test(). "f^^g^:^h" "g;" |
| 36 | snarf_testscip-shell shell shell-project 0.0.0 snarf_test(). "^^i^:^j^^k^:^" "i;k;" |
| 37 | snarf_testscip-shell shell shell-project 0.0.0 snarf_test(). "l^^m" "" |
| 38 | snarf_testscip-shell shell shell-project 0.0.0 snarf_test(). "n^:^o" "" |