This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Check that sparse files hold at least a block (bug in eCryptfs: https://bugs.launchpa...
[perl5.git] / t / op / attrhand.t
CommitLineData
ef097d42
RGS
1#!/usr/bin/perl -w
2
3BEGIN {
98d0ccc7
RGS
4 if ($ENV{PERL_CORE_MINITEST}) {
5 print "1..0 # skip: miniperl can't load attributes\n";
6 exit 0;
7 }
ef097d42
RGS
8 chdir 't' if -d 't';
9 @INC = '../lib';
10 require './test.pl';
11}
12
b384a05d 13plan tests => 4;
ef097d42
RGS
14
15# test for bug #38475: parsing errors with multiline attributes
16
17package Antler;
18
19use Attribute::Handlers;
20
21sub TypeCheck :ATTR(CODE,RAWDATA) {
22 ::ok(1);
23}
24
25sub WrongAttr :ATTR(CODE,RAWDATA) {
26 ::ok(0);
27}
28
b384a05d
SB
29sub CheckData :ATTR(RAWDATA) {
30 # check that the $data element contains the given attribute parameters.
31
32 if ($_[4] eq "12, 14") {
33 ::ok(1)
34 }
35 else {
36 ::ok(0)
37 }
38}
39
40sub CheckEmptyValue :ATTR() {
41 if (not defined $_[4]) {
42 ::ok(1)
43 }
44 else {
45 ::ok(0)
46 }
47}
48
ef097d42
RGS
49package Deer;
50use base 'Antler';
51
52sub something : TypeCheck(
53 QNET::Util::Object,
54 QNET::Util::Object,
55 QNET::Util::Object
56) { # WrongAttr (perl tokenizer bug)
57 # keep this ^ lined up !
58 return 42;
59}
60
61something();
b384a05d
SB
62
63sub c :CheckData(12, 14) {};
64
65sub d1 :CheckEmptyValue() {};
66sub d2 :CheckEmptyValue {};