tests/pass/op_close.lua

Mon, 22 Nov 2010 04:56:38 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 22 Nov 2010 04:56:38 +0000
changeset 126
07ec490c7a6f
permissions
-rw-r--r--

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 f = {};
07ec490c7a6f Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 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
3 local p;
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 p = 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 p;
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]("bar") == "bar");
07ec490c7a6f Add a whole bunch of tests I've been using for recent additions
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 assert(f[1]() == "foo");
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");

mercurial