1co = coroutine.wrap(function() 2 co() 3end) 4 5local ok, msg = pcall(function() 6 co() 7end) 8assert(not ok and string.find(msg, "can not resume a running thread")) 9 10co = coroutine.wrap(function() 11 return 1 12end) 13assert(co() == 1) 14local ok, msg = pcall(function() 15 co() 16end) 17assert(not ok and string.find(msg, "can not resume a dead thread")) 18