update test
This commit is contained in:
parent
791c06e035
commit
9764a5055c
@ -889,16 +889,16 @@ function test_reset()
|
|||||||
do
|
do
|
||||||
local form = curl.form()
|
local form = curl.form()
|
||||||
e = curl.easy{httppost = form}
|
e = curl.easy{httppost = form}
|
||||||
pfrom = weak_ptr(form)
|
pform = weak_ptr(form)
|
||||||
end
|
end
|
||||||
|
|
||||||
gc_collect()
|
gc_collect()
|
||||||
assert(pfrom.value)
|
assert(pform.value)
|
||||||
|
|
||||||
assert_equal(e, e:reset())
|
assert_equal(e, e:reset())
|
||||||
|
|
||||||
gc_collect()
|
gc_collect()
|
||||||
assert(not pfrom.value)
|
assert(not pform.value)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -207,6 +207,27 @@ function test_mimepost_does_not_ref_to_easy()
|
|||||||
assert_nil(peasy.value)
|
assert_nil(peasy.value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function test_cleanup_on_easy_reset()
|
||||||
|
|
||||||
|
local mime do
|
||||||
|
mime = weak_ptr(easy:mime())
|
||||||
|
easy:setopt_mimepost(mime.value)
|
||||||
|
end
|
||||||
|
|
||||||
|
gc_collect()
|
||||||
|
|
||||||
|
assert_not_nil(mime.value)
|
||||||
|
|
||||||
|
easy:reset()
|
||||||
|
|
||||||
|
gc_collect(10)
|
||||||
|
|
||||||
|
assert_nil(mime.value)
|
||||||
|
|
||||||
|
easy:setopt{url = GET_URL, writefunction = function() end}
|
||||||
|
easy:perform()
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local _ENV = TEST_CASE'mime basic' if not curl.OPT_MIMEPOST then
|
local _ENV = TEST_CASE'mime basic' if not curl.OPT_MIMEPOST then
|
||||||
@ -573,6 +594,38 @@ function test_pass_args()
|
|||||||
assert_match('Content%-Transfer%-Encoding:%s*base64', info)
|
assert_match('Content%-Transfer%-Encoding:%s*base64', info)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function easy_dump_mime(easy, mime, url)
|
||||||
|
assert(mime:addpart{
|
||||||
|
data = 'hello';
|
||||||
|
encoder = 'base64';
|
||||||
|
name = 'test';
|
||||||
|
filename = 'test.html';
|
||||||
|
type = 'test/html';
|
||||||
|
headers = {
|
||||||
|
'X-Custom-Header: hello';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
easy:setopt{
|
||||||
|
mimepost = mime;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(easy:setopt{
|
||||||
|
url = GET_URL;
|
||||||
|
customrequest = "GET";
|
||||||
|
|
||||||
|
writefunction = function()end;
|
||||||
|
})
|
||||||
|
|
||||||
|
if not ok then return nil, err end
|
||||||
|
|
||||||
|
ok, err = easy:perform()
|
||||||
|
|
||||||
|
if not ok then return nil, err end
|
||||||
|
|
||||||
|
return table.concat(buffer)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RUN()
|
RUN()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user