File: 05_send_error.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 (16 lines) | stat: -rw-r--r-- 409 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use Test::More tests => 2, import => ['!pass'];

use Dancer ':syntax';
use Dancer::Test;

set show_errors => 1;

get '/error' => sub {
    send_error "FAIL";
    # The next line is not executed, as 'send_error' breaks the route workflow
    die;
};

response_status_is [GET => '/error'] => 500,
  "status is 500 on send_error";
response_content_like [GET => '/error'] => qr/FAIL/, "content of error is kept";