Author: fperrad
Date: Wed May  2 01:34:39 2007
New Revision: 18395

Modified:
   trunk/languages/lua/t/Parrot/Test/Lua_lex.pm   (contents, props changed)
   trunk/languages/lua/t/test_lex.t   (contents, props changed)

Log:
[Lua]
- svn-property

Modified: trunk/languages/lua/t/Parrot/Test/Lua_lex.pm
==============================================================================
--- trunk/languages/lua/t/Parrot/Test/Lua_lex.pm        (original)
+++ trunk/languages/lua/t/Parrot/Test/Lua_lex.pm        Wed May  2 01:34:39 2007
@@ -1,110 +1,110 @@
-# Copyright (C) 2007, The Perl Foundation.

-# $Id: Lua_lex.pm $

-

-package Parrot::Test::Lua_lex;

-

-use strict;

-

-use Data::Dumper;

-use File::Basename;

-

-require Parrot::Test;

-

-=head1 NAME

-

-Test/Lua_lex.pm - Testing routines specific to 'lua' lexicography.

-

-=head1 DESCRIPTION

-

-Call F<languages/lua/test_lex.pir>.

-

-=head1 METHODS

-

-=head2 new

-

-Yet another constructor.

-

-=cut

-

-use strict;

-use warnings;

-

-sub new {

-    return bless {};

-}

-

-my %language_test_map = (

-    output_is   => 'is_eq',

-    output_like => 'like',

-    output_isnt => 'isnt_eq',

-);

-

-foreach my $func ( keys %language_test_map ) {

-    no strict 'refs';

-

-    *{"Parrot::Test::Lua_lex::$func"} = sub {

-        my $self = shift;

-        my ( $code, $output, $desc, %options ) = @_;

-

-        my $count = $self->{builder}->current_test + 1;

-

-        my $params = $options{params} || q{};

-

-        # flatten filenames (don't use directories)

-        my $lang_fn = Parrot::Test::per_test( '.lua', $count );

-        my $lua_out_fn = Parrot::Test::per_test( '.parrot_out', $count );

-        my @test_prog = (

-            "$self->{parrot} languages/lua/test_lex.pir languages/${lang_fn}",

-        );

-

-        # This does not create byte code, but lua code

-        Parrot::Test::write_code_to_file( $code, $lang_fn );

-

-        # STDERR is written into same output file

-        my $exit_code = Parrot::Test::run_command(

-            [EMAIL PROTECTED],

-            CD     => $self->{relpath},

-            STDOUT => $lua_out_fn,

-            STDERR => $lua_out_fn,

-        );

-

-        my $builder_func = $language_test_map{$func};

-

-        # That's the reason for:   no strict 'refs';

-        my $pass =

-            $self->{builder}

-            ->$builder_func( Parrot::Test::slurp_file($lua_out_fn), $output, 
$desc );

-        unless ($pass) {

-            my $diag = q{};

-            my $test_prog = join ' && ', @test_prog;

-            $diag .= "'$test_prog' failed with exit code $exit_code."

-                if $exit_code;

-            $self->{builder}->diag($diag) if $diag;

-        }

-

-        # The generated files are left in the t/* directories.

-        # Let 'make clean' and 'svn:ignore' take care of them.

-

-        return $pass;

-        }

-}

-

-=head1 SEE ALSO

-

-F<languages/lua/lib/Parrot/Test/Lua.pm>

-

-=head1 AUTHOR

-

-Francois Perrad

-

-=cut

-

-1;

-

-# Local Variables:

-#   mode: cperl

-#   cperl-indent-level: 4

-#   fill-column: 100

-# End:

-# vim: expandtab shiftwidth=4:

-

+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+
+package Parrot::Test::Lua_lex;
+
+use strict;
+
+use Data::Dumper;
+use File::Basename;
+
+require Parrot::Test;
+
+=head1 NAME
+
+Test/Lua_lex.pm - Testing routines specific to 'lua' lexicography.
+
+=head1 DESCRIPTION
+
+Call F<languages/lua/test_lex.pir>.
+
+=head1 METHODS
+
+=head2 new
+
+Yet another constructor.
+
+=cut
+
+use strict;
+use warnings;
+
+sub new {
+    return bless {};
+}
+
+my %language_test_map = (
+    output_is   => 'is_eq',
+    output_like => 'like',
+    output_isnt => 'isnt_eq',
+);
+
+foreach my $func ( keys %language_test_map ) {
+    no strict 'refs';
+
+    *{"Parrot::Test::Lua_lex::$func"} = sub {
+        my $self = shift;
+        my ( $code, $output, $desc, %options ) = @_;
+
+        my $count = $self->{builder}->current_test + 1;
+
+        my $params = $options{params} || q{};
+
+        # flatten filenames (don't use directories)
+        my $lang_fn = Parrot::Test::per_test( '.lua', $count );
+        my $lua_out_fn = Parrot::Test::per_test( '.parrot_out', $count );
+        my @test_prog = (
+            "$self->{parrot} languages/lua/test_lex.pir languages/${lang_fn}",
+        );
+
+        # This does not create byte code, but lua code
+        Parrot::Test::write_code_to_file( $code, $lang_fn );
+
+        # STDERR is written into same output file
+        my $exit_code = Parrot::Test::run_command(
+            [EMAIL PROTECTED],
+            CD     => $self->{relpath},
+            STDOUT => $lua_out_fn,
+            STDERR => $lua_out_fn,
+        );
+
+        my $builder_func = $language_test_map{$func};
+
+        # That's the reason for:   no strict 'refs';
+        my $pass =
+            $self->{builder}
+            ->$builder_func( Parrot::Test::slurp_file($lua_out_fn), $output, 
$desc );
+        unless ($pass) {
+            my $diag = q{};
+            my $test_prog = join ' && ', @test_prog;
+            $diag .= "'$test_prog' failed with exit code $exit_code."
+                if $exit_code;
+            $self->{builder}->diag($diag) if $diag;
+        }
+
+        # The generated files are left in the t/* directories.
+        # Let 'make clean' and 'svn:ignore' take care of them.
+
+        return $pass;
+        }
+}
+
+=head1 SEE ALSO
+
+F<languages/lua/lib/Parrot/Test/Lua.pm>
+
+=head1 AUTHOR
+
+Francois Perrad
+
+=cut
+
+1;
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
+

Modified: trunk/languages/lua/t/test_lex.t
==============================================================================
--- trunk/languages/lua/t/test_lex.t    (original)
+++ trunk/languages/lua/t/test_lex.t    Wed May  2 01:34:39 2007
@@ -1,167 +1,167 @@
-#! perl

-# Copyright (C) 2007, The Perl Foundation.

-# $Id: test_lex.t $

-

-=head1 NAME

-

-t/test_lex.t - Lua lexicography test

-

-=head1 SYNOPSIS

-

-    % perl -I../lib -Ilua/t lua/t/test_lex.t

-

-=head1 DESCRIPTION

-

-Tests Lua lexicograaphy

-(implemented in F<languages/lua/test_lex.pir>).

-

-See "Lua 5.1 Reference Manual", section 2.1 "Lexical Conventions",

-L<http://www.lua.org/manual/5.1/manual.html#2.1>.

-

-=cut

-

-use strict;

-use warnings;

-use FindBin;

-use lib "$FindBin::Bin";

-

-use Parrot::Test tests => 8;

-use Test::More;

-

-language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'hello' );

-print("hello")

-CODE

-Name:  print

-punct: (

-String:        hello

-punct: )

-OUT

-

-language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'keyword' );

-and

-break

-do

-else

-elseif

-end

-false

-for

-function

-if

-in

-local

-nil

-not

-or

-repeat

-return

-then

-true

-until

-while

-CODE

-keyword:       and

-keyword:       break

-keyword:       do

-keyword:       else

-keyword:       elseif

-keyword:       end

-keyword:       false

-keyword:       for

-keyword:       function

-keyword:       if

-keyword:       in

-keyword:       local

-keyword:       nil

-keyword:       not

-keyword:       or

-keyword:       repeat

-keyword:       return

-keyword:       then

-keyword:       true

-keyword:       until

-keyword:       while

-OUT

-

-language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'not keyword' );

-format      -- not for

-doit        -- not do

-CODE

-Name:  format

-Name:  doit

-OUT

-

-language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'string' );

-'alo\n123"'

-"alo\n123\""

-'\97lo\10\04923"'

-CODE

-String:        alo

-123"

-String:        alo

-123"

-String:        alo

-123"

-OUT

-

-language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'long string' );

-[[alo

-123"]]

-[==[

-alo

-123"]==]

-CODE

-LongString:    alo

-123"

-LongString:    alo

-123"

-OUT

-

-language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'number' );

-3

-3.0

-3.1416

-314.16e-2

-0.31416E1

-.31416E+1

-0xff

-0x56

-CODE

-Number:        3

-Number:        3.0

-Number:        3.1416

-Number:        314.16e-2

-Number:        0.31416E1

-Number:        .31416E+1

-Number:        0xff

-Number:        0x56

-OUT

-

-language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'comment' );

--- comment

-1   -- comment

-2

-CODE

-Number:        1

-Number:        2

-OUT

-

-language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'long comment' );

---[[

-long comment

-]]

-1

---[===[

-long comment

-]===]

-CODE

-Number:        1

-OUT

-

-# Local Variables:

-#   mode: cperl

-#   cperl-indent-level: 4

-#   fill-column: 100

-# End:

-# vim: expandtab shiftwidth=4:

-

+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+
+=head1 NAME
+
+t/test_lex.t - Lua lexicography test
+
+=head1 SYNOPSIS
+
+    % perl -I../lib -Ilua/t lua/t/test_lex.t
+
+=head1 DESCRIPTION
+
+Tests Lua lexicograaphy
+(implemented in F<languages/lua/test_lex.pir>).
+
+See "Lua 5.1 Reference Manual", section 2.1 "Lexical Conventions",
+L<http://www.lua.org/manual/5.1/manual.html#2.1>.
+
+=cut
+
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin";
+
+use Parrot::Test tests => 8;
+use Test::More;
+
+language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'hello' );
+print("hello")
+CODE
+Name:  print
+punct: (
+String:        hello
+punct: )
+OUT
+
+language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'keyword' );
+and
+break
+do
+else
+elseif
+end
+false
+for
+function
+if
+in
+local
+nil
+not
+or
+repeat
+return
+then
+true
+until
+while
+CODE
+keyword:       and
+keyword:       break
+keyword:       do
+keyword:       else
+keyword:       elseif
+keyword:       end
+keyword:       false
+keyword:       for
+keyword:       function
+keyword:       if
+keyword:       in
+keyword:       local
+keyword:       nil
+keyword:       not
+keyword:       or
+keyword:       repeat
+keyword:       return
+keyword:       then
+keyword:       true
+keyword:       until
+keyword:       while
+OUT
+
+language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'not keyword' );
+format      -- not for
+doit        -- not do
+CODE
+Name:  format
+Name:  doit
+OUT
+
+language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'string' );
+'alo\n123"'
+"alo\n123\""
+'\97lo\10\04923"'
+CODE
+String:        alo
+123"
+String:        alo
+123"
+String:        alo
+123"
+OUT
+
+language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'long string' );
+[[alo
+123"]]
+[==[
+alo
+123"]==]
+CODE
+LongString:    alo
+123"
+LongString:    alo
+123"
+OUT
+
+language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'number' );
+3
+3.0
+3.1416
+314.16e-2
+0.31416E1
+.31416E+1
+0xff
+0x56
+CODE
+Number:        3
+Number:        3.0
+Number:        3.1416
+Number:        314.16e-2
+Number:        0.31416E1
+Number:        .31416E+1
+Number:        0xff
+Number:        0x56
+OUT
+
+language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'comment' );
+-- comment
+1   -- comment
+2
+CODE
+Number:        1
+Number:        2
+OUT
+
+language_output_is( 'Lua_lex', <<'CODE', <<'OUT', 'long comment' );
+--[[
+long comment
+]]
+1
+--[===[
+long comment
+]===]
+CODE
+Number:        1
+OUT
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
+

Reply via email to