about summary refs log tree commit homepage
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-01-24 23:33:54 +0000
committerEric Wong <normalperson@yhbt.net>2013-02-01 21:46:27 +0000
commit8a6117a22a7d01eeb5adc63d3152acf435cd3176 (patch)
tree121c3fa707d28110e704dd6fd87cff985a5616a8 /t/test-lib.sh
parent0ba6fc3c30b9cf530faf7fcf5ce7be519ec13fe7 (diff)
downloadrainbows-8a6117a22a7d01eeb5adc63d3152acf435cd3176.tar.gz
On FreeBSD 9.0, "wc -c" 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 8921da6..26709bc 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 -c" outputs leading whitespace on *BSDs, filter it out for portability
+count_bytes () {
+        wc -c | tr -d '[:space:]'
+}
+
 skip_models () {
         for i in "$@"
         do