2 # Copyright (C) 2001-2010, Parrot Foundation.
7 use lib qw( . lib ../lib ../../lib );
15 t/src/warnings.t - Parrot warnings
19 % prove t/src/warnings.t
23 Test functions defined in src/warnings.c
27 Hacked from t/src/basics.t
31 c_output_is( <<'CODE', <<'OUTPUT', "print_pbc_location" );
33 #include <parrot/parrot.h>
34 #include <parrot/embed.h>
37 main(int argc, const char* argv[])
39 Parrot_Interp interp = Parrot_new(NULL);
43 print_pbc_location(interp);
45 Parrot_destroy(interp);
53 c_output_is( <<'CODE', <<'OUTPUT', "Parrot_warn" );
55 #include <parrot/parrot.h>
56 #include <parrot/embed.h>
59 main(int argc, const char* argv[])
61 Parrot_Interp interp = Parrot_new(NULL);
65 PARROT_WARNINGS_on(interp, PARROT_WARNINGS_ALL_FLAG);
67 error_val = Parrot_warn(interp, PARROT_WARNINGS_ALL_FLAG, "all");
68 Parrot_io_eprintf(interp, "%d\n", error_val);
70 /* warnings are on, this should return an error */
71 error_val = Parrot_warn(interp, PARROT_WARNINGS_NONE_FLAG, "none");
72 Parrot_io_eprintf(interp, "%d\n", error_val);
74 error_val = Parrot_warn(interp, PARROT_WARNINGS_UNDEF_FLAG, "undef");
75 Parrot_io_eprintf(interp, "%d\n", error_val);
77 error_val = Parrot_warn(interp, PARROT_WARNINGS_IO_FLAG, "io");
78 Parrot_io_eprintf(interp, "%d\n", error_val);
80 error_val = Parrot_warn(interp, PARROT_WARNINGS_PLATFORM_FLAG, "platform");
81 Parrot_io_eprintf(interp, "%d\n", error_val);
83 error_val = Parrot_warn(interp, PARROT_WARNINGS_DYNEXT_FLAG, "dynext");
84 Parrot_io_eprintf(interp, "%d\n", error_val);
86 error_val = Parrot_warn(interp, 0, "eek"); /* should return error */
87 Parrot_io_eprintf(interp, "%d\n", error_val);
89 Parrot_destroy(interp);
115 # cperl-indent-level: 4
118 # vim: expandtab shiftwidth=4: