Permalink
Browse files

Add an m0 test for the illegal redefinitino of an alias

  • Loading branch information...
1 parent c654de6 commit c565eafbdde53876a6b0b4a222b502a868d986af @leto leto committed May 25, 2012
Showing with 33 additions and 2 deletions.
  1. +25 −0 t/m0/invalid/invalid_register_alias.m0
  2. +8 −2 t/m0/m0_assembler.t
@@ -0,0 +1,25 @@
+# THIS IS INVALID M0 FOR TESTING PURPOSES ONLY
+.version 0
+
+
+.chunk "stuff"
+
+
+# This defines our constants table
+.constants
+0 1
+1 "hello world"
+
+.metadata
+
+
+.bytecode
+ .alias counter = I0
+ .alias counter = I1
+
+ set_imm S, 0, 1
+
+
+
+# This code isn't really PASM, but the highlighting works well.
+# vim: expandtab shiftwidth=4 ft=pasm:
View
@@ -1,5 +1,5 @@
#! perl
-# Copyright (C) 2011, Parrot Foundation.
+# Copyright (C) 2012, Parrot Foundation.
=head1 NAME
@@ -23,7 +23,7 @@ use File::Slurp qw/slurp/;
use Test::More;
use File::Spec::Functions;
-plan tests => 30;
+plan tests => 31;
my $exefile = catfile( ".", qw/src m0 perl5 m0_assembler.pl/ );
my $hello_m0 = catfile(qw/t m0 basic hello.m0/);
@@ -154,6 +154,12 @@ output_like(
);
output_like(
+ catfile(qw/t m0 invalid invalid_register_alias.m0/),
+ qr/Illegal redefintion of/,
+ 'detect invalid redefinition of an alias'
+);
+
+output_like(
catfile(qw/t m0 invalid invalid_register_number2.m0/),
qr/Invalid register.*S/,
'detect invalid registers (S)',

0 comments on commit c565eaf

Please sign in to comment.