Skip to content

Commit 4741353

Browse files
committed
Update test
1 parent 7f405f0 commit 4741353

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/test_urlapi.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ local curl = require "cURL"
1616
local scurl = require "cURL.safe"
1717
local utils = require "utils"
1818

19-
local tostring = tostring
19+
local tostring, pcall = tostring, pcall
20+
21+
local function skip_case(msg) return function() skip(msg) end end
2022

2123
local ENABLE = true
2224

2325
local _ENV = TEST_CASE'urlapi' if ENABLE then
2426

25-
if not curl.E_URL_OK then skip('URL API avaliable since libcurl 7.62.0') else
27+
if not curl.E_URL_OK then test = skip_case('URL API avaliable since libcurl 7.62.0') else
2628

2729
local it = setmetatable(_ENV or _M, {__call = function(self, describe, fn)
2830
self["test " .. describe] = fn
@@ -177,7 +179,8 @@ end)
177179

178180
it('should raise error for invalid url', function()
179181
url = curl.url()
180-
assert_error_match('CURL%-URL', function() url:get_url() end)
182+
local _, err = assert_false(pcall(url.get_url, url))
183+
assert_match('CURL%-URL', tostring(err))
181184
end)
182185

183186
-- it('should set encoded query', function()

0 commit comments

Comments
 (0)