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