aboutsummaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authorPjotr Prins2021-08-24 12:45:38 +0200
committerPjotr Prins2021-08-24 12:45:38 +0200
commite18913d175cf1f21b1a8393e45c188342370b160 (patch)
treea815ed96a35f25f9fa5859bb98e0ac46f308f254 /test/lib
parent71553f5e5626e1d791b5be24c84ea6b17ae81cc7 (diff)
downloadpangemma-e18913d175cf1f21b1a8393e45c188342370b160.tar.gz
Tests: started to replace the test system - moving from shell scripts to Ruby tests
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/test-helpers.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/lib/test-helpers.rb b/test/lib/test-helpers.rb
new file mode 100644
index 0000000..72b9cd9
--- /dev/null
+++ b/test/lib/test-helpers.rb
@@ -0,0 +1,24 @@
+module TestHelpers
+
+ # Runs gemma and returns true if successful
+ def gemma(opts)
+ system("./bin/gemma #{opts}")
+ end
+
+ def read(fn, line=0)
+ count = 0
+ File.open(fn, "r:utf-8").each_line { |ln|
+ return ln.chomp.split("\t") if count == line
+ count += 1
+ }
+ end
+
+ def expect(fn, list)
+ lines = File.read(fn).split("\n") # avoid this for large files
+ list.each do | l |
+ line,colnum,value = l
+ cols = lines[line].chomp.split("\t")
+ assert_equal value,cols[colnum]
+ end
+ end
+end