2 # Copyright (C) 2008-2010, Parrot Foundation.
5 .sub 'init_test_builder_tester'
6 load_bytecode 'Test/Builder/Tester.pbc'
8 .local pmc exports, curr_namespace, test_namespace
9 curr_namespace = get_namespace
10 test_namespace = get_root_namespace [ 'parrot'; 'Test'; 'Builder'; 'Tester' ]
11 exports = split ' ', 'plan test_out test_diag test_test'
12 test_namespace.'export_to'( curr_namespace, exports )
16 load_bytecode 'runtime/parrot/library/Test/More.pbc'
18 # get the testing functions
19 .local pmc exports, curr_namespace, test_namespace
20 curr_namespace = get_namespace [ 'Foo' ]
21 test_namespace = get_root_namespace [ 'parrot'; 'Test'; 'More' ]
22 exports = split ' ', 'diag ok is is_deeply like isa_ok skip'
24 test_namespace.'export_to'(curr_namespace, exports)
27 .sub 'init_test_class'
28 load_bytecode 'Test/Class.pbc'
32 init_test_builder_tester()
37 class = subclass [ 'Test'; 'Class' ], 'Foo'
44 test_out( 'ok 1 - startup called' )
45 test_out( 'ok 2 - setup one' )
46 test_out( 'ok 3 - setup two' )
47 test_out( 'ok 4 - foo first' )
48 test_out( 'ok 5 - foo second' )
49 test_out( 'ok 6 - foo third' )
50 test_out( 'ok 7 - tearing down' )
51 test_out( 'ok 8 - setup one' )
52 test_out( 'ok 9 - setup two' )
53 test_out( 'ok 10 - bar second' )
54 test_out( 'ok 11 - bar third' )
55 test_out( 'ok 12 - tearing down' )
56 test_out( 'ok 13 - shutdown called' )
60 test_test( 'tests run in proper order, test plan expressed, tests wrapped' )
65 .sub 'init' :vtable :method
66 self.'add_startup'( 'startup', 'tests' => 1 )
67 self.'add_shutdown'( 'shutdown', 'tests' => 1 )
68 self.'add_setup'( 'setup', 'tests' => 2 )
69 self.'add_teardown'( 'teardown', 'tests' => 1 )
70 self.'add_test'( 'test_foo', 'tests' => 3 )
71 self.'add_test'( 'test_bar', 'tests' => 2 )
74 .sub 'startup' :method
75 ok( 1, 'startup called' )
78 .sub 'shutdown' :method
79 ok( 1, 'shutdown called' )
87 .sub 'teardown' :method
88 ok( 1, 'tearing down' )
91 .sub 'test_foo' :method
97 .sub 'test_bar' :method
106 # vim: expandtab shiftwidth=4 ft=pir: