Avoid non-portable `tail' argument in `test-guile-snarf'.
authorLudovic Courtès <ludo@gnu.org>
Sat, 14 Jan 2012 21:25:59 +0000 (22:25 +0100)
committerLudovic Courtès <ludo@gnu.org>
Sat, 14 Jan 2012 21:25:59 +0000 (22:25 +0100)
* test-suite/standalone/test-guile-snarf (strip_first_line): New
  function.
  (snarf): Use it.

test-suite/standalone/test-guile-snarf

index 41a9dc6..e314791 100755 (executable)
@@ -1,7 +1,23 @@
 #!/bin/sh
+
+# Test the `guile-snarf' tool.
+
+# Strip the first line, like GNU `tail -n +2' does, but in a portable
+# way (`tail' on Solaris 10 doesn't support `-n +2' for instance.)
+strip_first_line ()
+{
+    read line
+    while read line
+    do
+       echo "$line"
+    done
+}
+
 snarf ()
 {
-    echo "$1" | guile-snarf - | tail -n +2 | tr -d ' \t\n'
+    # GNU cpp emits a comment on the first line, which shows what
+    # arguments it was passed.  Strip this line.
+    echo "$1" | guile-snarf - | strip_first_line | tr -d ' \t\n'
 }
 
 snarf_test ()