2 # Copyright (C) 2007, The Perl Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 3;
13 t/pmc/scheduler.t - Concurrency Scheduler
17 % prove t/pmc/scheduler.t
21 Tests the concurrency scheduler PMC.
26 pir_output_is( <<'CODE', <<'OUT', "create a concurrency scheduler and set attributes" );
35 if null $P2 goto no_task
36 $P3 = getattribute $P2, 'status'
42 print "no task to retrieve\n"
55 pir_output_is( <<'CODE', <<'OUT', "create a concurrency scheduler with initializer" );
65 $P0 = new 'Scheduler', data
72 if null $P2 goto no_task
73 $P3 = getattribute $P2, 'status'
78 say 'no task to retrieve'
83 push_eh bad_initializer
84 $P0 = new 'Scheduler', id
87 say "No exception on invalid initializer? Uh oh!"
91 say "Caught exception on bad initializer"
97 Caught exception on bad initializer
100 pir_output_is( <<'CODE', <<'OUT', "add event handler and corresponding event to scheduler" );
102 .local pmc handler, handler_init, handler_sub
103 .local pmc event, event_init
104 handler_init = new 'Hash'
105 handler_init['type'] = 'myevent'
106 handler_sub = get_global 'my_event_handler'
107 handler_init['code'] = handler_sub
108 handler = new 'EventHandler', handler_init
112 event_init = new 'Hash'
113 event_init['type'] = 'event'
114 event_init['subtype'] = 'myevent'
115 event = new 'Task', event_init
121 .sub my_event_handler
123 .param pmc handledtask
124 print "called event handler\n"
132 # cperl-indent-level: 4
135 # vim: expandtab shiftwidth=4: