summaryrefslogtreecommitdiff
path: root/lib/strict.t
blob: d6c6ed0e411c9b1644ec7d00c94f7eae90160689 (plain)
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
#!./perl

chdir 't' if -d 't';
@INC = '../lib';

our $local_tests = 6;
require "../t/lib/common.pl";

eval qq(use strict 'garbage');
like($@, qr/^Unknown 'strict' tag\(s\) 'garbage'/);

eval qq(no strict 'garbage');
like($@, qr/^Unknown 'strict' tag\(s\) 'garbage'/);

eval qq(use strict qw(foo bar));
like($@, qr/^Unknown 'strict' tag\(s\) 'foo bar'/);

eval qq(no strict qw(foo bar));
like($@, qr/^Unknown 'strict' tag\(s\) 'foo bar'/);

eval 'use v5.12; use v5.10; ${"c"}';
is($@, '', 'use v5.10 disables implicit strict refs');

eval 'use strict; use v5.10; ${"c"}';
like($@,
    qr/^Can't use string \("c"\) as a SCALAR ref while "strict refs" in use/,
    "use v5.10 doesn't disable explicit strict ref");