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 u; |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 | local f = {}; |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 | for i=1,2 do |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 | f[i] = function (set) |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 | if set then |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 | u = set; |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 | end |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 | return u; |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 | end; |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 | end |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 | |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 | assert(f[1]("foo") == "foo"); |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 | assert(f[2]() == "foo"); |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 | |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 | assert(f[2]("bar") == "bar"); |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
16 | assert(f[1]() == "bar"); |
07ec490c7a6f
Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 |