Author: paultcochrane Date: Sun Dec 2 13:33:30 2007 New Revision: 23381 Added: trunk/t/src/warnings.t (contents, props changed) Modified: trunk/MANIFEST
Log: [t] Added tests of the functions in src/warnings.c Modified: trunk/MANIFEST ============================================================================== --- trunk/MANIFEST (original) +++ trunk/MANIFEST Sun Dec 2 13:33:30 2007 @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Sun Dec 2 20:44:43 2007 UT +# generated by tools/dev/mk_manifest_and_skip.pl Sun Dec 2 21:33:02 2007 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -165,8 +165,6 @@ compilers/pirc/new/pirlexer.h [] compilers/pirc/new/pirparser.c [] compilers/pirc/new/pirparser.h [] -compilers/pirc/new/pirsymbol.c [] -compilers/pirc/new/pirsymbol.h [] compilers/pirc/pirc.c [] compilers/pirc/src/README.pod [] compilers/pirc/src/jsonout.c [] @@ -620,11 +618,11 @@ examples/io/pipe2.pir [main]doc examples/io/pipe3.pir [main]doc examples/japh/README [main]doc -examples/japh/japh1.pasm [main]doc -examples/japh/japh2.pasm [main]doc examples/japh/japh3.pasm [main]doc examples/japh/japh4.pasm [main]doc examples/japh/japh5.pasm [main]doc +examples/japh/japh6.pasm [main]doc +examples/japh/japh8.pasm [main]doc examples/library/acorn.l [main]doc examples/library/getopt_demo.pir [main]doc examples/library/md5sum.pir [main]doc @@ -1904,6 +1902,7 @@ languages/plumhead/lib/Parrot/Test/Plumhead/Antlr3.pm [plumhead] languages/plumhead/lib/Parrot/Test/Plumhead/PCT.pm [plumhead] languages/plumhead/lib/Parrot/Test/Plumhead/PHP.pm [plumhead] +languages/plumhead/lib/Parrot/Test/Plumhead/Partridge.pm [plumhead] languages/plumhead/lib/Parrot/Test/Plumhead/Phc.pm [plumhead] languages/plumhead/lib/Parrot/Test/Plumhead/Yacc.pm [plumhead] languages/plumhead/past_xml.xsd [plumhead] @@ -1916,6 +1915,9 @@ languages/plumhead/src/antlr3/PlumheadParser.java [plumhead] languages/plumhead/src/common/builtins.pir [plumhead] languages/plumhead/src/common/plumhead.pir [plumhead] +languages/plumhead/src/common/plumhead_pct.pir [plumhead] +languages/plumhead/src/partridge/Plumhead.pg [plumhead] +languages/plumhead/src/partridge/PlumheadPAST.tg [plumhead] languages/plumhead/src/pct/Plumhead.pg [plumhead] languages/plumhead/src/pct/PlumheadPAST.tg [plumhead] languages/plumhead/src/phc/past_xml_to_past_pir.xsl [plumhead] @@ -3048,7 +3050,7 @@ t/configure/113-auto_msvc-01.t [] t/configure/113-auto_msvc-02.t [] t/configure/113-auto_msvc-03.t [] -t/configure/114-auto_attributes-01.t [] +t/configure/114-auto_attributes.t [] t/configure/115-auto_warnings.t [] t/configure/116-init_optimize-01.t [] t/configure/116-init_optimize-02.t [] @@ -3398,6 +3400,7 @@ t/src/list.t [] t/src/sprintf.t [] t/src/string.t [] +t/src/warnings.t [] t/stm/basic.t [] t/stm/basic_mt.t [] t/stm/llqueue.t [] Added: trunk/t/src/warnings.t ============================================================================== --- (empty file) +++ trunk/t/src/warnings.t Sun Dec 2 13:33:30 2007 @@ -0,0 +1,191 @@ +#! perl +# Copyright (C) 2001-2006, The Perl Foundation. +# $Id$ + +use strict; +use warnings; +use lib qw( . lib ../lib ../../lib ); +use Test::More; +use Parrot::Test; + +plan tests => 3; + +=head1 NAME + +t/src/warnings.t - Parrot warnings + +=head1 SYNOPSIS + + % prove t/src/warnings.t + +=head1 DESCRIPTION + +Test functions defined in src/warnings.c + +=head1 HISTORY + +Hacked from t/src/basics.t + +=cut + +c_output_is( <<'CODE', <<'OUTPUT', "print_pbc_location" ); + +#include <parrot/parrot.h> +#include <parrot/embed.h> + +int +main(int argc, char* argv[]) +{ + Interp *interp; + int error_val; + + interp = Parrot_new(NULL); + if (!interp) { + return 1; + } + + print_pbc_location(interp); + + Parrot_exit(interp, 0); + return 0; +} +CODE +(null) +OUTPUT + +c_output_is( <<'CODE', <<'OUTPUT', "Parrot_warn" ); + +#include <parrot/parrot.h> +#include <parrot/embed.h> + +int +main(int argc, char* argv[]) +{ + Interp *interp; + int error_val; + + interp = Parrot_new(NULL); + if (!interp) { + return 1; + } + PARROT_WARNINGS_on(interp, PARROT_WARNINGS_ALL_FLAG); + + error_val = Parrot_warn(interp, PARROT_WARNINGS_ALL_FLAG, "all"); + PIO_eprintf(interp, "%d\n", error_val); + + /* warnings are on, this should return an error */ + error_val = Parrot_warn(interp, PARROT_WARNINGS_NONE_FLAG, "none"); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn(interp, PARROT_WARNINGS_UNDEF_FLAG, "undef"); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn(interp, PARROT_WARNINGS_IO_FLAG, "io"); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn(interp, PARROT_WARNINGS_PLATFORM_FLAG, "platform"); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn(interp, PARROT_WARNINGS_DYNEXT_FLAG, "dynext"); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn(interp, 0, "eek"); /* should return error */ + PIO_eprintf(interp, "%d\n", error_val); + + Parrot_exit(interp, 0); + return 0; +} +CODE +all +(null) +1 +2 +undef +(null) +1 +io +(null) +1 +platform +(null) +1 +dynext +(null) +1 +2 +OUTPUT + +c_output_is( <<'CODE', <<'OUTPUT', "Parrot_warn_s" ); + +#include <parrot/parrot.h> +#include <parrot/embed.h> + +int +main(int argc, char* argv[]) +{ + Interp *interp; + int error_val; + STRING *S; + + interp = Parrot_new(NULL); + if (!interp) { + return 1; + } + PARROT_WARNINGS_on(interp, PARROT_WARNINGS_ALL_FLAG); + + S = Parrot_sprintf_c(interp, "eek"); + error_val = Parrot_warn_s(interp, PARROT_WARNINGS_ALL_FLAG, S); + PIO_eprintf(interp, "%d\n", error_val); + + /* warnings are on, this should return an error */ + error_val = Parrot_warn_s(interp, PARROT_WARNINGS_NONE_FLAG, S); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn_s(interp, PARROT_WARNINGS_UNDEF_FLAG, S); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn_s(interp, PARROT_WARNINGS_IO_FLAG, S); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn_s(interp, PARROT_WARNINGS_PLATFORM_FLAG, S); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn_s(interp, PARROT_WARNINGS_DYNEXT_FLAG, S); + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn_s(interp, 0, "eek"); /* should return error */ + PIO_eprintf(interp, "%d\n", error_val); + + error_val = Parrot_warn_s(NULL, 0, "eek"); /* should return error */ + PIO_eprintf(interp, "%d\n", error_val); + + Parrot_exit(interp, 0); + return 0; +} +CODE +eek +(null) +1 +2 +eek +(null) +1 +eek +(null) +1 +eek +(null) +1 +eek +(null) +1 +2 +2 +OUTPUT + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: