diff options
author | Pjotr Prins | 2021-08-24 12:45:38 +0200 |
---|---|---|
committer | Pjotr Prins | 2021-08-24 12:45:38 +0200 |
commit | e18913d175cf1f21b1a8393e45c188342370b160 (patch) | |
tree | a815ed96a35f25f9fa5859bb98e0ac46f308f254 /test/lib | |
parent | 71553f5e5626e1d791b5be24c84ea6b17ae81cc7 (diff) | |
download | pangemma-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.rb | 24 |
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 |