File: 007_implicit_undef.t

package info (click to toggle)
libreadonly-perl 2.050-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 216 kB
  • sloc: perl: 871; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 637 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!perl -I../../lib
# Verify the Readonly function accepts implicit undef values
use strict;
use Test::More;
use Readonly;

sub expected {
    my $line = shift;
    $@ =~ s/\.$//;    # difference between croak and die
    return "Invalid tie at " . __FILE__ . " line $line\n";
}
SKIP: {
    skip 'Readonly $@% syntax is for perl 5.8 or later', 1 unless $] >= 5.008;
    eval 'Readonly my $simple;';
    is $@ => '', 'Simple API allows for implicit undef values';
}
eval q'Readonly::Scalar my $scalar;';
like $@ => qr[Not enough arguments for Readonly::Scalar],
    'Readonly::Scalar does not allow implicit undef values';
#
done_testing;