summaryrefslogtreecommitdiff
path: root/indra/newview/tests/llluamanager_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/tests/llluamanager_test.cpp')
-rw-r--r--indra/newview/tests/llluamanager_test.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/indra/newview/tests/llluamanager_test.cpp b/indra/newview/tests/llluamanager_test.cpp
index 069e10e9cf..1dd081fb98 100644
--- a/indra/newview/tests/llluamanager_test.cpp
+++ b/indra/newview/tests/llluamanager_test.cpp
@@ -311,23 +311,27 @@ namespace tut
const std::string lua(
"-- test leap.lua\n"
"\n"
+ "fiber = require('fiber')\n"
"leap = require('leap')\n"
- "coro = require('coro')\n"
+ "-- debug = require('printf')\n"
+ "local function debug(...) end\n"
"\n"
"-- negative priority ensures catchall is always last\n"
"catchall = leap.WaitFor:new(-1, 'catchall')\n"
"function catchall:filter(pump, data)\n"
+ " debug('catchall:filter(%s, %s)', pump, data)\n"
" return data\n"
"end\n"
"\n"
"-- but first, catch events with 'special' key\n"
"catch_special = leap.WaitFor:new(2, 'catch_special')\n"
"function catch_special:filter(pump, data)\n"
+ " debug('catch_special:filter(%s, %s)', pump, data)\n"
" return if data['special'] ~= nil then data else nil\n"
"end\n"
"\n"
"function drain(waitfor)\n"
- " print(waitfor.name .. ' start')\n"
+ " debug('%s start', waitfor.name)\n"
" -- It seems as though we ought to be able to code this loop\n"
" -- over waitfor:wait() as:\n"
" -- for item in waitfor.wait, waitfor do\n"
@@ -335,28 +339,30 @@ namespace tut
" -- the coroutine call stack, which prohibits coroutine.yield():\n"
" -- 'attempt to yield across metamethod/C-call boundary'\n"
" -- So we resort to two different calls to waitfor:wait().\n"
- " item = waitfor:wait()\n"
+ " local item = waitfor:wait()\n"
" while item do\n"
- " print(waitfor.name .. ' caught', item)\n"
+ " debug('%s caught %s', waitfor.name, item)\n"
" item = waitfor:wait()\n"
" end\n"
- " print(waitfor.name .. ' done')\n"
+ " debug('%s done', waitfor.name)\n"
"end\n"
"\n"
"function requester(name)\n"
- " print('requester('..name..') start')\n"
- " response = leap.request('testpump', {name=name})\n"
- " print('requester('..name..') got '..tostring(response))\n"
+ " debug('requester(%s) start', name)\n"
+ " local response = leap.request('testpump', {name=name})\n"
+ " debug('requester(%s) got %s', name, response)\n"
" -- verify that the correct response was dispatched to this coroutine\n"
" assert(response.name == name)\n"
"end\n"
"\n"
- "coro.launch(drain, catchall)\n"
- "coro.launch(drain, catch_special)\n"
- "coro.launch(requester, 'a')\n"
- "coro.launch(requester, 'b')\n"
- "\n"
- "leap.process()\n"
+ "-- fiber.print_all()\n"
+ "fiber.launch('catchall', drain, catchall)\n"
+ "fiber.launch('catch_special', drain, catch_special)\n"
+ "fiber.launch('requester(a)', requester, 'a')\n"
+ "-- requester(a)\n"
+ "fiber.launch('requester(b)', requester, 'b')\n"
+ "-- fiber.print_all()\n"
+ "-- fiber.run()\n"
);
LLSD requests;