summaryrefslogtreecommitdiff
path: root/tests/modules/bytes/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-20 22:52:37 +0800
committerruki <[email protected]>2021-09-20 22:52:37 +0800
commit68f4ab938564a43656236de3a0eb67f9222bc876 (patch)
treee1df5be901cd0c63cdeaaf61218107a86d9e9d66 /tests/modules/bytes/test.lua
parent07cabd568b07120e227e29a945bc45dcc05a0db2 (diff)
improve bytes
Diffstat (limited to 'tests/modules/bytes/test.lua')
-rw-r--r--tests/modules/bytes/test.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/modules/bytes/test.lua b/tests/modules/bytes/test.lua
index aa29e3493..8d4504f2c 100644
--- a/tests/modules/bytes/test.lua
+++ b/tests/modules/bytes/test.lua
@@ -12,16 +12,19 @@ function test_ctor(t)
t:are_equal(bytes(10):size(), 10)
t:are_equal(bytes(bytes("123"), bytes("456"), bytes("789")):str(), "123456789")
t:are_equal(bytes({bytes("123"), bytes("456"), bytes("789")}):str(), "123456789")
+ debug.collectgarbage()
end
function test_clone(t)
t:are_equal(bytes(10):clone():size(), 10)
t:are_equal(bytes("123456789"):clone():str(), "123456789")
+ debug.collectgarbage()
end
function test_slice(t)
t:are_equal(bytes(10):slice(1, 2):size(), 2)
t:are_equal(bytes("123456789"):slice(1, 4):str(), "1234")
+ debug.collectgarbage()
end
function test_index(t)
@@ -34,9 +37,11 @@ function test_index(t)
b[1] = string.byte('2')
t:are_equal(b:str(), "223456789")
t:will_raise(function() b[100] = string.byte('2') end)
+ debug.collectgarbage()
end
function test_concat(t)
t:are_equal((bytes("123") .. bytes("456")):str(), "123456")
t:are_equal(bytes(bytes("123"), bytes("456")):str(), "123456")
+ debug.collectgarbage()
end