2 # Copyright (C) 2006-2008, The Perl Foundation.
7 use lib qw( . lib ../lib ../../lib );
10 use Parrot::OpLib::core;
14 t/op/01-parse_ops.t - Parse core opcodes
18 % prove t/op/01-parse_ops.t
22 Tests that all parrot opcodes are parsed properly.
30 kc => q<[ 'foo' ; 'bar' ]>,
33 ksc => q<[ 'foo' ; 'bar' ]>,
37 pc => undef, ## RT#39992 figure out how to test this type
42 my %parse_errors = map { $_ => 1 } qw(
74 ## extract the register types from each opcode
75 for my $op (@$Parrot::OpLib::core::ops) {
76 my @regtypes = $op->arg_types;
78 ## for now, avoid opcodes with regtypes i don't know how to represent
79 next unless @regtypes == grep { defined $$object_map{$_} } @regtypes;
81 ## extract the basename of the opcode
82 my $basename = $op->name;
84 ## create the argument list
85 my $args = join ', ' => map $$object_map{$_}, @regtypes;
87 ## store the test commands
88 $cmds{$basename}{ $basename . ' ' . $args }++;
89 $cmds{$basename}{ $op->full_name . ' ' . $args }++;
92 $ENV{TEST_PROG_ARGS} ||= '';
94 plan skip_all => 'IMCC cannot do parse-only with JIT enabled'
95 if $ENV{TEST_PROG_ARGS} =~ /-j/;
97 plan skip_all => 'IMCC cannot do parse-only with switched core'
98 if $ENV{TEST_PROG_ARGS} =~ /-S/;
100 plan tests => scalar keys %cmds;
102 for my $cmd ( sort keys %cmds ) {
104 ## retrieve the test commands, and trick IMCC to parse only
105 join( $/ => 'end', sort( keys %{ $cmds{$cmd} } ), '' ),
106 qr/^(?!error:imcc:syntax error,)/,
110 if ( $parse_errors{$cmd} ) {
111 pasm_error_output_like(@args);
114 pasm_output_like(@args);
120 # cperl-indent-level: 4
123 # vim: expandtab shiftwidth=4: