Skip to content

Commit a6511ba

Browse files
committed
Add. Test compatibility safe and unsafe objects
1 parent 08c15d9 commit a6511ba

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

test/test_safe.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,37 @@ end
242242

243243
end
244244

245+
local _ENV = TEST_CASE'objects_have_same_metatables' do
246+
247+
local scurl = require "lcurl.safe"
248+
local curl = require "lcurl"
249+
local e1, e2, m
250+
251+
function teardown()
252+
if m then m:close() end
253+
if e1 then e1:close() end
254+
if e2 then e2:close() end
255+
e1, e2, m = nil
256+
end
257+
258+
function test_1()
259+
e1 = assert(scurl.easy())
260+
e2 = assert(curl.easy())
261+
m = assert(scurl.multi())
262+
263+
assert_equal(m, m:add_handle(e1))
264+
assert_equal(m, m:add_handle(e2))
265+
end
266+
267+
function test_2()
268+
e1 = assert(scurl.easy())
269+
e2 = assert(curl.easy())
270+
m = assert(curl.multi())
271+
272+
assert_equal(m, m:add_handle(e1))
273+
assert_equal(m, m:add_handle(e2))
274+
end
275+
276+
end
277+
245278
if not HAS_RUNNER then lunit.run() end

0 commit comments

Comments
 (0)