From 25b489a34ad55818a7407ce32f3c89968a1d240f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 29 Sep 2011 03:36:13 -0500 Subject: remove test numbers --- t/01-basic.t | 88 ----------------------------------------- t/basic.t | 88 +++++++++++++++++++++++++++++++++++++++++ t/data/01/templates/foo.tt | 1 - t/data/01/templates/index.tt | 1 - t/data/basic/templates/foo.tt | 1 + t/data/basic/templates/index.tt | 1 + 6 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 t/01-basic.t create mode 100644 t/basic.t delete mode 100644 t/data/01/templates/foo.tt delete mode 100644 t/data/01/templates/index.tt create mode 100644 t/data/basic/templates/foo.tt create mode 100644 t/data/basic/templates/index.tt diff --git a/t/01-basic.t b/t/01-basic.t deleted file mode 100644 index 51c04ba..0000000 --- a/t/01-basic.t +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Test::More; -use Plack::Test; -use FindBin; - -use HTTP::Request::Common; -use Path::Class (); - -{ - package Foo::Controller; - use Moose; - - has view => ( - is => 'ro', - isa => 'OX::View::TT', - required => 1, - handles => ['render'], - ); - - our $AUTOLOAD; - sub AUTOLOAD { - my $self = shift; - my ($r) = @_; - (my $template = $AUTOLOAD) =~ s/.*:://; - $template .= '.tt'; - my $defaults = $r->env->{'plack.router.match'}->mapping; - $self->render($r, $template, $defaults); - } - sub can { 1 } -} - -{ - package Foo; - use OX; - - has template_root => ( - is => 'ro', - isa => 'Str', - block => sub { - Path::Class::dir($FindBin::Bin)->subdir('data', '01', 'templates')->stringify - }, - ); - - has view => ( - is => 'ro', - isa => 'OX::View::TT', - dependencies => ['template_root'], - ); - - has root => ( - is => 'ro', - isa => 'Foo::Controller', - dependencies => ['view'], - ); - - router as { - route '/' => 'root.index', ( - content => 'Hello world', - ); - route '/foo' => 'root.foo'; - }; -} - -my $foo = Foo->new; -my $view = $foo->view; -isa_ok($view, 'OX::View::TT'); -isa_ok($view->tt, 'Template'); - -test_psgi - app => $foo->to_app, - client => sub { - my $cb = shift; - - { - my $res = $cb->(GET 'http://localhost/'); - is($res->code, 200, "right code"); - is($res->content, "Hello world\n", "right content"); - } - { - my $res = $cb->(GET 'http://localhost/foo'); - is($res->code, 200, "right code"); - is($res->content, "

/foo

\n", "right content"); - } - }; - -done_testing; diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..a9d238c --- /dev/null +++ b/t/basic.t @@ -0,0 +1,88 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use Plack::Test; +use FindBin; + +use HTTP::Request::Common; +use Path::Class (); + +{ + package Foo::Controller; + use Moose; + + has view => ( + is => 'ro', + isa => 'OX::View::TT', + required => 1, + handles => ['render'], + ); + + our $AUTOLOAD; + sub AUTOLOAD { + my $self = shift; + my ($r) = @_; + (my $template = $AUTOLOAD) =~ s/.*:://; + $template .= '.tt'; + my $defaults = $r->env->{'plack.router.match'}->mapping; + $self->render($r, $template, $defaults); + } + sub can { 1 } +} + +{ + package Foo; + use OX; + + has template_root => ( + is => 'ro', + isa => 'Str', + block => sub { + Path::Class::dir($FindBin::Bin)->subdir('data', 'basic', 'templates')->stringify + }, + ); + + has view => ( + is => 'ro', + isa => 'OX::View::TT', + dependencies => ['template_root'], + ); + + has root => ( + is => 'ro', + isa => 'Foo::Controller', + dependencies => ['view'], + ); + + router as { + route '/' => 'root.index', ( + content => 'Hello world', + ); + route '/foo' => 'root.foo'; + }; +} + +my $foo = Foo->new; +my $view = $foo->view; +isa_ok($view, 'OX::View::TT'); +isa_ok($view->tt, 'Template'); + +test_psgi + app => $foo->to_app, + client => sub { + my $cb = shift; + + { + my $res = $cb->(GET 'http://localhost/'); + is($res->code, 200, "right code"); + is($res->content, "Hello world\n", "right content"); + } + { + my $res = $cb->(GET 'http://localhost/foo'); + is($res->code, 200, "right code"); + is($res->content, "

/foo

\n", "right content"); + } + }; + +done_testing; diff --git a/t/data/01/templates/foo.tt b/t/data/01/templates/foo.tt deleted file mode 100644 index f3acdb5..0000000 --- a/t/data/01/templates/foo.tt +++ /dev/null @@ -1 +0,0 @@ -

[% uri_for('action' => action, 'controller' => controller) %]

diff --git a/t/data/01/templates/index.tt b/t/data/01/templates/index.tt deleted file mode 100644 index d9df92b..0000000 --- a/t/data/01/templates/index.tt +++ /dev/null @@ -1 +0,0 @@ -[% content %] diff --git a/t/data/basic/templates/foo.tt b/t/data/basic/templates/foo.tt new file mode 100644 index 0000000..f3acdb5 --- /dev/null +++ b/t/data/basic/templates/foo.tt @@ -0,0 +1 @@ +

[% uri_for('action' => action, 'controller' => controller) %]

diff --git a/t/data/basic/templates/index.tt b/t/data/basic/templates/index.tt new file mode 100644 index 0000000..d9df92b --- /dev/null +++ b/t/data/basic/templates/index.tt @@ -0,0 +1 @@ +[% content %] -- cgit v1.2.3-54-g00ecf