test_tsv.lua

changeset 1
29e532c213f7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test_tsv.lua	Sat Oct 31 16:28:42 2009 +0000
@@ -0,0 +1,19 @@
+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