Commits

Burak Gürsoy committed 6910804

fix monolith test

Comments (0)

Files changed (5)

 
 Time zone is UTC+2.
 
+0.79_08 Fri Aug  7 03:42:48 2009
+   => Fix monolith test.
+
 0.79_07 Thu Aug  6 04:17:38 2009
    => Implemented the monolith test.
    => monolith option does not work with interpolated includes. It's currently

lib/Text/Template/Simple.pm

 use strict;
 use vars qw($VERSION);
 
-$VERSION = '0.79_07';
+$VERSION = '0.79_08';
 
 use File::Spec;
 use Text::Template::Simple::Constants qw(:all);
 #!/usr/bin/env perl -w
 use strict;
+use subs qw( trim );
 use Test::More qw( no_plan );
 use Text::Template::Simple;
 
    monolith => 1,
 );
 
-my $got = $t->compile( 't/data/monolith.tts' );
-chomp $got;
+my $got      = trim $t->compile( 't/data/monolith.tts' );
+my $expected = trim expected();
 
-is( $got, expected(), "Testing Monolith");
+is( $got, $expected, "Testing Monolith");
 
 sub expected {
     <<'EXPECT';
-
 [ dynamic include error ] Interpolated includes don't work under monolith option. Please disable monolith and use the 'SHARE' directive in the include command: t/data/monolith-1.tts | PARAM: 'test'
-$VAR1 = [
-          42,
-          {
-            'abc' => 123
-          },
-          1,
-          2,
-          3
-        ];
-
-$VAR1 = [
-          42,
-          {
-            'abc' => 123
-          },
-          1,
-          2,
-          3
-        ];
-
+$VAR1 = [42,{'abc' => 123},1,2,3];
+$VAR1 = [42,{'abc' => 123},1,2,3];
 EXPECT
 }
+
+sub trim {
+    my $s = shift;
+    $s =~ s{ \A \s+    }{}xms;
+    $s =~ s{    \s+ \z }{}xms;
+    $s;
+}

t/data/monolith-2.tts

-<%= Dumper [ $foo, \%bar, @baz] %>
+<%= Dumper [ $foo, \%bar, @baz] %>
 <%* t/data/monolith-3.tts %>

t/data/monolith.tts

-<%
-   my $foo = 42;
-   my %bar = ( abc => 123 );
-   my @baz = ( 1..3 );
-   use Data::Dumper;
-%>
-<%* t/data/monolith-1.tts | PARAM: 'test' %>
-<%* t/data/monolith-2.tts %>
-
+<%
+   my $foo = 42;
+   my %bar = ( abc => 123 );
+   my @baz = ( 1..3 );
+   use Data::Dumper;
+   $Data::Dumper::Indent = 0;
+%>
+<%* t/data/monolith-1.tts | PARAM: 'test' %>
+<%* t/data/monolith-2.tts %>