test_tsv.lua

Sat, 31 Oct 2009 16:28:42 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 31 Oct 2009 16:28:42 +0000
changeset 1
29e532c213f7
permissions
-rw-r--r--

Add tests

dofile "test_data.lua"

local tsv = require "tsv"

local row = 0;
for line in io.lines("test_data.tsv") do
	row = row + 1;
	local col = 0;
	tsv.read_record(line, function (v) 
		col = col + 1;
		if data[row][col] ~= v then
			print(("MISMATCH at row %d, column %d: %s is not %s")
				:format(row, col, v, tostring(data[row][col])))
			bad = true;
		end
	end);
end

os.exit(bad and 1 or 0);

mercurial