Sat, 31 Oct 2009 16:28:42 +0000
Add tests
1 | 1 | dofile "test_data.lua" |
2 | ||
3 | local tsv = require "tsv" | |
4 | ||
5 | local row = 0; | |
6 | for line in io.lines("test_data.tsv") do | |
7 | row = row + 1; | |
8 | local col = 0; | |
9 | tsv.read_record(line, function (v) | |
10 | col = col + 1; | |
11 | if data[row][col] ~= v then | |
12 | print(("MISMATCH at row %d, column %d: %s is not %s") | |
13 | :format(row, col, v, tostring(data[row][col]))) | |
14 | bad = true; | |
15 | end | |
16 | end); | |
17 | end | |
18 | ||
19 | os.exit(bad and 1 or 0); |