tests/pass/gmatch.lua

changeset 126
07ec490c7a6f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/pass/gmatch.lua	Mon Nov 22 04:56:38 2010 +0000
@@ -0,0 +1,10 @@
+local i = 1;
+local s = "the rain in spain stays mainly in the plain";
+local st = { "the", "rain", "in", "spain", "stays", "mainly", "in", "the", "plain" };
+for word in string.gmatch(s, "%a+") do
+	print(word)
+	assert(word == st[i], word.." == "..st[i]);
+	i = i + 1;
+end
+
+assert(i == 10, i.." == 10");

mercurial