File: manual-test-cb-non-string-error.lua

package info (click to toggle)
lua-luv 1.48.0-2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,036 kB
  • sloc: ansic: 6,565; makefile: 72; sh: 33
file content (24 lines) | stat: -rw-r--r-- 562 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
return require('lib/tap')(function (test)
  test("timer callback with errors", function(print, p, expect, uv)
    local Error = {}
    Error.__index = Error

    function Error.new(msg)
        local o = setmetatable({}, Error)
        o.msg = assert(msg)
        return o
    end

    function Error:__tostring()
        return assert(tostring(self.msg))
    end

    local timer = uv.new_timer()
    timer:start(10, 0, function()
      timer:stop()
      timer:close()
      local e = Error.new('Error in timeout callback')
      error(e)
    end)
  end)
end)