Mon, 22 Nov 2010 04:56:38 +0000
Add a whole bunch of tests I've been using for recent additions
126
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 | local i = 1; |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 | local s = "the rain in spain stays mainly in the plain"; |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 | local st = { "the", "rain", "in", "spain", "stays", "mainly", "in", "the", "plain" }; |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 | for word in string.gmatch(s, "%a+") do |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 | print(word) |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 | assert(word == st[i], word.." == "..st[i]); |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 | i = i + 1; |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 | end |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 | |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 | assert(i == 10, i.." == 10"); |