From 4bba62eb8de961cbfc0ba53cd26b9667db551748 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 7 Oct 2012 00:48:57 -0500 Subject: basic test --- t/basic.t | 44 ++++++++++++++++++++++++++++++++++++++++++++ t/basic/index.html | 4 ++++ t/basic/wrapper.tx | 10 ++++++++++ 3 files changed, 58 insertions(+) create mode 100644 t/basic.t create mode 100644 t/basic/index.html create mode 100644 t/basic/wrapper.tx diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..a7f66b4 --- /dev/null +++ b/t/basic.t @@ -0,0 +1,44 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use Plack::Test; + +use HTTP::Request::Common; +use Plack::Builder; + +my $app = builder { + enable "Xslate", + path => qr{^/}, root => 't/basic/', pass_through => 1; + sub { [ 404, [], [ 'Not found' ] ] }; +}; + +test_psgi + app => $app, + client => sub { + my $cb = shift; + + { + my $res = $cb->(GET '/index.html'); + ok($res->is_success) || diag($res->content); + is($res->content, <<'CONTENT'); + + + + + + + +

Hello world

+ + +CONTENT + } + + { + my $res = $cb->(GET '/missing.html'); + is($res->code, 404); + } + }; + +done_testing; diff --git a/t/basic/index.html b/t/basic/index.html new file mode 100644 index 0000000..8518a6a --- /dev/null +++ b/t/basic/index.html @@ -0,0 +1,4 @@ +: cascade 'wrapper.tx' +: override content -> { +

Hello world

+: } diff --git a/t/basic/wrapper.tx b/t/basic/wrapper.tx new file mode 100644 index 0000000..5739c50 --- /dev/null +++ b/t/basic/wrapper.tx @@ -0,0 +1,10 @@ + + + + + + + +: block content -> { } + + -- cgit v1.2.3