1 | serpent = go("#158") |
2 | |
3 | go("#121") -- compareTables |
4 | assert(compareTables) |
5 | |
6 | function assertEquals(actual, expected) |
7 | assert(expected == actual, actual) |
8 | end |
9 | |
10 | function check(tbl) |
11 | local s = serpent.block(tbl) |
12 | print(s) |
13 | local env = newCleanEnv() |
14 | assert(compareTables) |
15 | local f, err = load("return "..s, "serpent-made code", "t", env) |
16 | if err then print(err) end |
17 | assert(f) |
18 | print(f) |
19 | assert(compareTables) |
20 | local t = f() |
21 | assert(compareTables) |
22 | assert(compareTables(tbl, t)) |
23 | end |
24 | |
25 | check {} |
26 | return true |
Began life as a copy of #154
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date |
---|---|---|---|
289 | #1000604 (pitcher) | 2015-08-18 00:54:27 | |
244 | #1000610 (pitcher) | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { serpent = go("#158") go("#121") -- compareTables assert(compareTables) function assertEquals(actual, expected) assert(expected == actual, actual) end function check(tbl) local s = serpent.block(tbl) print(s) local env = newCleanEnv() assert(compareTables) local f, err = load("return "..s, "serpent-made code", "t", env) if err then print(err) end assert(f) print(f) assert(compareTables) local t = f() assert(compareTables) assert(compareTables(tbl, t)) end check {} return true }} | 2015-08-18 00:52:42 |
Recognizer | Recognition Result | Visualize | Recalc |
---|---|---|---|
#308 | 534 | [visualize] |
Snippet ID: | #159 |
Snippet name: | test for serpent.lua |
Eternal ID of this version: | #159/1 |
Text MD5: | 1a930c5c7bada68242c5bb684b532cb9 |
Author: | stefan |
Category: | table serializers |
Type: | Lua code - System test |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2014-01-13 04:16:35 |
Source code size: | 534 bytes / 26 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1333 / 244 |
Referenced in: | [show references] |