|
Revision 234, 366 bytes
(checked in by cho45, 16 months ago)
|
|
lua,
lua/misc,
lua/misc/INI.lua,
lua/misc/t-sandbox.lua,
lua/misc/Test.lua,
lua/misc/t-ini.lua,
lua/misc/Class.lua,
lua/misc/t-class.lua,
lua/misc/List.lua,
lua/misc/t-list.lua,
lua/misc/SandBox.lua:
Lua の簡単なライブラリ
|
| Line | |
|---|
| 1 | --[[ |
|---|
| 2 | Test module for Lua |
|---|
| 3 | ]] |
|---|
| 4 | |
|---|
| 5 | function eq(v, expected, msg) |
|---|
| 6 | if not msg then msg = "" end |
|---|
| 7 | |
|---|
| 8 | if v == expected then |
|---|
| 9 | return true |
|---|
| 10 | else |
|---|
| 11 | local info = debug.getinfo(2) |
|---|
| 12 | error( |
|---|
| 13 | string.format( |
|---|
| 14 | "%s->%s: get `%s' but expected `%s'; %s", |
|---|
| 15 | info.short_src, |
|---|
| 16 | info.currentline, |
|---|
| 17 | tostring(v), |
|---|
| 18 | tostring(expected), |
|---|
| 19 | msg |
|---|
| 20 | ) |
|---|
| 21 | ) |
|---|
| 22 | end |
|---|
| 23 | end |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | assert(eq(1, 1)) |
|---|