File: 04-errors.t

package info (click to toggle)
libcgi-application-plugin-viewcode-perl 1.02-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 276 kB
  • sloc: perl: 1,783; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 915 bytes parent folder | download | duplicates (5)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use Test::More;
use CGI;
use lib 't/lib';
use MyBase::MyApp;
use strict;

#plan(tests => 23);
plan('no_plan');

$ENV{'CGI_APP_RETURN_ONLY'} = 1;

# 1..2
# non existant module
{
    my $module = 'Some::NonExistant::Module';
    my $cgi = CGI->new({
        rm => 'view_code',
        module  => $module,
    });
    my $app = MyBase::MyApp->new( QUERY => $cgi );
    my $output = $app->run();
    like($output, qr/View Source Error/i);
    like($output, qr/Module \Q$module\E does not exist/i);
}

# 3..4
# non existant file
{
    my $module = 'Some::NonExistant::Module';
    my $file = 'Some/NonExistant/Module.pm';
    my $cgi = CGI->new({
        rm => 'view_code',
        module  => $module,
    });
    $INC{$file} = $file;
    my $app = MyBase::MyApp->new( QUERY => $cgi );
    my $output = $app->run();
    like($output, qr/View Source Error/i);
    like($output, qr/File \Q$file\E does not exist/i);
}