@@ -382,6 +382,7 @@ function setup()
382382 f = assert (scurl .form ())
383383 c = assert (scurl .easy {
384384 url = url ,
385+ timeout = 60 ,
385386 })
386387 assert_equal (c , c :setopt_writefunction (table.insert , t ))
387388end
@@ -441,6 +442,23 @@ function test_abort_05()
441442 assert_error_match (" READERROR" , function () c :perform () end )
442443end
443444
445+ function test_abort_06 ()
446+ assert_equal (f , f :add_stream (' SSSSS' , 128 , function () return false end ))
447+ assert_equal (c , c :setopt_httppost (f ))
448+
449+ local _ , e = assert_nil (c :perform ())
450+ assert_equal (curl .error (curl .ERROR_EASY , curl .E_ABORTED_BY_CALLBACK ), e )
451+ end
452+
453+ function test_pass_01 ()
454+ assert_equal (c , c :setopt_timeout (10 ))
455+ assert_equal (f , f :add_stream (' SSSSS' , 128 , function () return nil end ))
456+ assert_equal (c , c :setopt_httppost (f ))
457+
458+ local _ , e = assert_nil (c :perform ())
459+ assert_equal (curl .error (curl .ERROR_EASY , curl .E_OPERATION_TIMEDOUT ), e )
460+ end
461+
444462function test_pause ()
445463 local counter = 0
446464 assert_equal (f , f :add_stream (' SSSSS' , 128 , function ()
@@ -529,6 +547,13 @@ function test_abort_05()
529547 assert_error_match (" READERROR" , function () c :perform () end )
530548end
531549
550+ function test_abort_06 ()
551+ assert_equal (c , c :setopt_readfunction (function () return false end ))
552+
553+ local _ , e = assert_nil (c :perform ())
554+ assert_equal (curl .error (curl .ERROR_EASY , curl .E_ABORTED_BY_CALLBACK ), e )
555+ end
556+
532557function test_pause ()
533558 local counter = 0
534559 assert_equal (c , c :setopt_readfunction (function ()
@@ -576,6 +601,15 @@ function test_readbuffer()
576601 assert_equal ((" s" ):rep (N ), data )
577602end
578603
604+ function test_pass_01 ()
605+ assert_equal (c , c :setopt_readfunction (function () return nil end ))
606+
607+ assert_equal (c , c :perform ())
608+ c :close ()
609+ local data = read_file (fname )
610+ assert_equal (0 , # data )
611+ end
612+
579613end
580614
581615local _ENV = TEST_CASE ' escape' if ENABLE then
0 commit comments