about summary refs log tree commit homepage
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-02-04 12:39:09 +0000
committerEric Wong <normalperson@yhbt.net>2013-02-04 13:38:13 +0000
commite6faf9e26bcb172026a4984ecadbaa8b6789bcb7 (patch)
tree37d8b44818b1f62b7c285124073c85fa50e202e5 /t/test-lib.sh
parentf4e3bac180ff01256832f98655636f79b52f9d5b (diff)
downloadrainbows-e6faf9e26bcb172026a4984ecadbaa8b6789bcb7.tar.gz
On FreeBSD 9.0, "wc -l" emits leading whitespace, so
filter it through tr -d '[:space:]' to eliminate it.
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 26709bc..3471d69 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -43,6 +43,11 @@ unix_time () {
         $RUBY -e 'puts Time.now.to_i'
 }
 
+# "wc -l" outputs leading whitespace on *BSDs, filter it out for portability
+count_lines () {
+        wc -l | tr -d '[:space:]'
+}
+
 # "wc -c" outputs leading whitespace on *BSDs, filter it out for portability
 count_bytes () {
         wc -c | tr -d '[:space:]'