fix codetest failure - ASSERT_ARGS does not have a ; after and
[parrot.git] / t / src / exit.t
blob0a0eb41b382b2a82ab9837fdc138d5fa9cb8a085
1 #! perl
2 # Copyright (C) 2001-2005, Parrot Foundation.
3 # $Id$
5 use strict;
6 use warnings;
7 use lib qw( . lib ../lib ../../lib );
8 use Test::More;
9 use Parrot::Test tests => 1;
11 =head1 NAME
13 t/src/exit.t - Exiting
15 =head1 SYNOPSIS
17     % prove t/src/exit.t
19 =head1 DESCRIPTION
21 Tests C<Parrot_exit()> and C<Parrot_on_exit()> functions.
23 =cut
25 c_output_is( <<'CODE', <<'OUTPUT', "on_exit - interpreter" );
26 #include <stdio.h>
27 #include <parrot/parrot.h>
28 #include <parrot/embed.h>
30 void
31 ex1(PARROT_INTERP, int x, void*p)
33     printf("ex1\n");
36 void
37 ex2(PARROT_INTERP, int x, void*p)
39     printf("ex2\n");
42 void
43 ex3(PARROT_INTERP, int x, void*p)
45     Parrot_io_printf(interp, "ex3\n");
48 int
49 main(int argc, char* argv[])
51     Interp *interp;
53     interp = Parrot_new(NULL);
54     if (!interp) {
55         return 1;
56     }
57     Parrot_on_exit(interp, ex1, 0);
58     Parrot_on_exit(interp, ex2, 0);
59     Parrot_on_exit(interp, ex3, 0);
60     Parrot_exit(interp, 0);
61     exit(0);
63 CODE
64 ex3
65 ex2
66 ex1
67 OUTPUT
69 # Local Variables:
70 #   mode: cperl
71 #   cperl-indent-level: 4
72 #   fill-column: 100
73 # End:
74 # vim: expandtab shiftwidth=4: