Update test
This commit is contained in:
parent
8f4a0980ca
commit
6453a60c4a
@ -38,48 +38,40 @@ function test_write_to_file()
|
|||||||
assert_equal(c, c:perform())
|
assert_equal(c, c:perform())
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_write_to_file_abort_01()
|
function test_write_abort_01()
|
||||||
c = assert(scurl.easy{
|
c = assert(scurl.easy{
|
||||||
url = url;
|
url = url;
|
||||||
writefunction = function(str)
|
writefunction = function(str) return #str - 1 end;
|
||||||
return #str - 1
|
|
||||||
end;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local _, e = assert_nil(c:perform())
|
local _, e = assert_nil(c:perform())
|
||||||
assert_equal(curl.error(curl.ERROR_EASY, curl.E_WRITE_ERROR), e)
|
assert_equal(curl.error(curl.ERROR_EASY, curl.E_WRITE_ERROR), e)
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_write_to_file_abort_02()
|
function test_write_abort_02()
|
||||||
c = assert(scurl.easy{
|
c = assert(scurl.easy{
|
||||||
url = url;
|
url = url;
|
||||||
writefunction = function(str)
|
writefunction = function(str) return false end;
|
||||||
return false
|
|
||||||
end;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local _, e = assert_nil(c:perform())
|
local _, e = assert_nil(c:perform())
|
||||||
assert_equal(curl.error(curl.ERROR_EASY, curl.E_WRITE_ERROR), e)
|
assert_equal(curl.error(curl.ERROR_EASY, curl.E_WRITE_ERROR), e)
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_write_to_file_abort_03()
|
function test_write_abort_03()
|
||||||
c = assert(scurl.easy{
|
c = assert(scurl.easy{
|
||||||
url = url;
|
url = url;
|
||||||
writefunction = function(str)
|
writefunction = function(str) return nil, "WRITEERROR" end;
|
||||||
return nil, "WRITEERROR"
|
|
||||||
end;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local _, e = assert_nil(c:perform())
|
local _, e = assert_nil(c:perform())
|
||||||
assert_equal("WRITEERROR", e)
|
assert_equal("WRITEERROR", e)
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_write_to_file_abort_04()
|
function test_write_abort_04()
|
||||||
c = assert(scurl.easy{
|
c = assert(scurl.easy{
|
||||||
url = url;
|
url = url;
|
||||||
writefunction = function(str)
|
writefunction = function(str) return nil end;
|
||||||
return nil
|
|
||||||
end;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local _, e = assert_nil(c:perform())
|
local _, e = assert_nil(c:perform())
|
||||||
@ -94,6 +86,34 @@ function test_reset_write_callback()
|
|||||||
assert_equal(c, c:setopt_writefunction(print))
|
assert_equal(c, c:setopt_writefunction(print))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function test_write_pass_01()
|
||||||
|
c = assert(curl.easy{
|
||||||
|
url = url;
|
||||||
|
writefunction = function(s) return #s end
|
||||||
|
})
|
||||||
|
|
||||||
|
assert_equal(c, c:perform())
|
||||||
|
end
|
||||||
|
|
||||||
|
function test_write_pass_02()
|
||||||
|
c = assert(curl.easy{
|
||||||
|
url = url;
|
||||||
|
writefunction = function() return end
|
||||||
|
})
|
||||||
|
|
||||||
|
assert_equal(c, c:perform())
|
||||||
|
end
|
||||||
|
|
||||||
|
function test_write_pass_03()
|
||||||
|
c = assert(curl.easy{
|
||||||
|
url = url;
|
||||||
|
writefunction = function() return true end
|
||||||
|
})
|
||||||
|
|
||||||
|
assert_equal(c, c:perform())
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local _ENV = TEST_CASE'escape' do
|
local _ENV = TEST_CASE'escape' do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user