From 68f4ab938564a43656236de3a0eb67f9222bc876 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 20 Sep 2021 22:52:37 +0800 Subject: improve bytes --- tests/modules/bytes/test.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/modules/bytes/test.lua') 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 -- cgit v1.3.1