diff options
| author | ruki <[email protected]> | 2022-03-02 23:18:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-03-02 23:18:40 +0800 |
| commit | 6026401e3bc55e0b5974c0aa18aefe4d7135fe89 (patch) | |
| tree | 435735b6009ece189bda720db95ceda0f69cb928 /tests/modules/table/test.lua | |
| parent | 0654d3ea2b7a9063adadd6b3a2c5fe2b0ff7883f (diff) | |
improve table.wrap
Diffstat (limited to 'tests/modules/table/test.lua')
| -rw-r--r-- | tests/modules/table/test.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/modules/table/test.lua b/tests/modules/table/test.lua index 5ed17620c..426dfe516 100644 --- a/tests/modules/table/test.lua +++ b/tests/modules/table/test.lua @@ -9,3 +9,19 @@ function test_find_if(t) t:are_equal(table.find({1, 2, 4, 4, 5, 6}, 4), {3, 4}) t:are_equal(table.find_first({1, 2, 3, 4, 5, 6}, 4), 4) end + +function test_wrap() + t:are_equal(talbe.wrap(1), {1}) + t:are_equal(talbe.wrap(nil), {}) + t:are_equal(talbe.wrap({}), {}) + t:are_equal(talbe.wrap({1}), {1}) + t:are_equal(talbe.wrap({{}}), {{}}) +end + +function test_unwrap() + t:are_equal(talbe.unwrap(1), 1) + t:are_equal(talbe.unwrap(nil), nil) + t:are_equal(talbe.unwrap({}), nil) + t:are_equal(talbe.unwrap({1}), 1) + t:are_equal(talbe.unwrap({{}}), {}) +end |
