File: override_errors.t

package info (click to toggle)
libmethod-signatures-perl 20170211-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 672 kB
  • sloc: perl: 3,860; makefile: 2
file content (25 lines) | stat: -r--r--r-- 765 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/perl

use strict;
use warnings;
use lib 't/lib';

use Test::More;
use Test::Exception;


use OverrideErrors { compile_at_BEGIN => 0 };

func biff (    $bar) {}
func bamm (   :$bar) {}
func boom (Int $bar) {}

throws_ok { biff( )            } qr/you suck!/,                             'required param missing from overridden errors';
throws_ok { bamm( snork => 1 ) } qr/and yo mama's ugly, too/,               'no such named param from overridden errors';
throws_ok { boom( .5 )         } qr/she got a wooden leg with a kickstand/, 'value of wrong type from overridden errors';

# make sure our subclass is getting skipped properly
throws_ok { biff() } qr/^In call to main::biff.*$0 line/, 'subclassing reports errors from proper place';


done_testing;