File: 09_load_app.t

package info (click to toggle)
libdancer-perl 1.3521%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,460 kB
  • sloc: perl: 7,436; xml: 2,211; sh: 54; makefile: 32; sql: 5
file content (25 lines) | stat: -rw-r--r-- 691 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use Test::More tests => 5, import => ['!pass'];
use strict;
use warnings;

use Dancer ':syntax';
use File::Basename;
use lib dirname(__FILE__) . "/lib";

# XXX appdir is set to the path of the current test
use Dancer::Test appdir => path($0);

eval { load_app 'UnexistentApp' };
like $@, qr/unable to load application UnexistentApp : Can't locate/, 
    'load_app fails if the app is not found';

eval { load_app 'AppWithError' };
like $@, qr/unable to load application AppWithError : Bareword/, 
    'load_app fails if the app has syntax errors';

eval { load_app 'WorkingApp' };
is $@, '', "WorkingApp loaded";

route_exists [ GET => '/app'];
response_content_is [ GET => '/app'], "app";