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(
58 ## extract the register types from each opcode
59 for my $op (@$Parrot::OpLib::core::ops) {
60 my @regtypes = $op->arg_types;
62 ## for now, avoid opcodes with regtypes i don't know how to represent
63 next unless @regtypes == grep { defined $$object_map{$_} } @regtypes;
65 ## extract the basename of the opcode
66 my $basename = $op->name;
68 ## create the argument list
69 my $args = join ', ' => map $$object_map{$_}, @regtypes;
71 ## store the test commands
72 $cmds{$basename}{ $basename . ' ' . $args }++;
75 $ENV{TEST_PROG_ARGS} ||= '';
77 plan skip_all => 'IMCC cannot do parse-only with JIT enabled'
78 if $ENV{TEST_PROG_ARGS} =~ /-j/;
80 plan skip_all => 'IMCC cannot do parse-only with switched core'
81 if $ENV{TEST_PROG_ARGS} =~ /-S/;
83 plan tests => scalar keys %cmds;
85 for my $cmd ( sort keys %cmds ) {
87 ## retrieve the test commands, and trick IMCC to parse only
88 join( $/ => 'end', sort( keys %{ $cmds{$cmd} } ), '' ),
89 qr/^(?!error:imcc:syntax error,)/,
93 if ( $parse_errors{$cmd} ) {
94 pasm_error_output_like(@args);
97 pasm_output_like(@args);
103 # cperl-indent-level: 4
106 # vim: expandtab shiftwidth=4: