[Rt-commit] r6445 - in rtir/branches/2.1-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Wed Nov 15 23:58:56 EST 2006
Author: ruz
Date: Wed Nov 15 23:58:55 2006
New Revision: 6445
Added:
rtir/branches/2.1-EXPERIMENTAL/t/000-mason-syntax.t
Modified:
rtir/branches/2.1-EXPERIMENTAL/ (props changed)
rtir/branches/2.1-EXPERIMENTAL/META.yml
rtir/branches/2.1-EXPERIMENTAL/Makefile.PL
Log:
r1841 at cubic-pc: cubic | 2006-11-16 08:00:57 +0300
* test syntax of our mason components with a HTML::Mason::Compiler
Modified: rtir/branches/2.1-EXPERIMENTAL/META.yml
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/META.yml (original)
+++ rtir/branches/2.1-EXPERIMENTAL/META.yml Wed Nov 15 23:58:55 2006
@@ -1,5 +1,8 @@
abstract: RT IR Extension
author: Best Practical Solutions <sales at bestpractical.com>
+build_requires:
+ File::Find: 0
+ Test::More: 0
distribution_type: module
generated_by: Module::Install version 0.640
license: GPL Version 2
Modified: rtir/branches/2.1-EXPERIMENTAL/Makefile.PL
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/Makefile.PL (original)
+++ rtir/branches/2.1-EXPERIMENTAL/Makefile.PL Wed Nov 15 23:58:55 2006
@@ -36,6 +36,9 @@
requires('Net::CIDR');
requires('Regexp::Common::net::CIDR');
+build_requires('Test::More');
+build_requires('File::Find');
+
auto_install();
substitute( {
Added: rtir/branches/2.1-EXPERIMENTAL/t/000-mason-syntax.t
==============================================================================
--- (empty file)
+++ rtir/branches/2.1-EXPERIMENTAL/t/000-mason-syntax.t Wed Nov 15 23:58:55 2006
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+my $ok = 1;
+
+use File::Find;
+find( {
+ no_chdir => 1,
+ wanted => sub {
+ return if /\.(?:jpe?g|png|gif)$/i;
+ return unless -f $_;
+ diag "testing $_" if $ENV{'TEST_VERBOSE'};
+ eval { compile_file($_) } and return;
+ $ok = 0;
+ diag "error in ${File::Find::name}:\n$@";
+ },
+}, 'html');
+ok($ok, "mason syntax is ok");
+
+use HTML::Mason::Compiler;
+use HTML::Mason::Compiler::ToObject;
+
+sub compile_file {
+ my $file = shift;
+
+ open my $fh, '<:utf8', $file or die "couldn't open '$file': $!";
+ my $text = do { local $/; <$fh> };
+ close $fh or die "couldn't close '$file': $!";
+
+ my $compiler = new HTML::Mason::Compiler::ToObject;
+ $compiler->compile( comp_source => $text, name => 'my' );
+ return 1;
+}
+
More information about the Rt-commit
mailing list