File: 48rt-115983.t

package info (click to toggle)
libdatetime-perl 2%3A1.50-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,504 kB
  • sloc: perl: 2,964; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 576 bytes parent folder | download
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 strict;
use warnings;

use Test::Fatal;
use Test::More;

use DateTime;

# The bug here is that if DateTime doesn't clean it's namespace, it ends up
# having a catch method that is getting called here and being passed a hashref
# containing the return value of $dt->truncate. See
# https://rt.cpan.org/Ticket/Display.html?id=115983

my $dt = DateTime->now;
like(
    exception {
        try { } catch {
            $dt->truncate( to => 'hour' );
        };
    },
    qr/Can\'t locate object method "catch"/,
    'DateTime does not have a catch method'
);

done_testing();