1
1
use Test;
2
- plan 14 ;
2
+ plan 36 ;
3
3
4
4
# | simple case
5
5
class Simple {
6
6
# = not so simple now!
7
7
}
8
8
9
- is Simple.WHY.content, " simple case\n not so simple now!" ;
9
+ is Simple.WHY.content, " simple case\n not so simple now!" ;
10
+ is Simple.WHY.leading, " simple case" ;
11
+ is Simple.WHY.trailing, " not so simple now!" ;
10
12
is ~Simple.WHY, " simple case\n not so simple now!" , ' stringifies correctly' ;
11
13
12
14
# | a module
@@ -22,18 +24,28 @@ module foo {
22
24
}
23
25
}
24
26
25
- is foo.WHY.content, " a module\n moar module stuff" ;
26
- is foo::bar.WHY.content, " a package\n more package stuff" ;
27
- is foo::bar::baz.WHY.content, " and a class\n more class stuff" ;
27
+ is foo.WHY.content, " a module\n moar module stuff" ;
28
+ is foo.WHY.leading, " a module" ;
29
+ is foo.WHY.trailing, " moar module stuff" ;
30
+ is foo::bar.WHY.content, " a package\n more package stuff" ;
31
+ is foo::bar.WHY.leading, " a package" ;
32
+ is foo::bar.WHY.trailing, " more package stuff" ;
33
+ is foo::bar::baz.WHY.content, " and a class\n more class stuff" ;
34
+ is foo::bar::baz.WHY.leading, " and a class" ;
35
+ is foo::bar::baz.WHY.trailing, " more class stuff" ;
28
36
29
37
# | yellow
30
38
sub marine {}
31
39
# = submarine
32
- is &marine.WHY.content, " yellow\n submarine" ;
40
+ is &marine.WHY.content, " yellow\n submarine" ;
41
+ is &marine.WHY.leading, " yellow" ;
42
+ is &marine.WHY.trailing, " submarine" ;
33
43
34
44
# | pink
35
45
sub panther {} # = panther
36
- is &panther.WHY.content, " pink\n panther" ;
46
+ is &panther.WHY.content, " pink\n panther" ;
47
+ is &panther.WHY.leading, " pink" ;
48
+ is &panther.WHY.trailing, " panther" ;
37
49
38
50
# | a sheep
39
51
class Sheep {
@@ -46,12 +58,16 @@ class Sheep {
46
58
47
59
is Sheep.WHY.content, ' a sheep' ;
48
60
is Sheep.^attributes.grep ({ .name eq ' $!wool' })[0].WHY, " usually white\n not very dirty" ;
61
+ is Sheep.^attributes.grep ({ .name eq ' $!wool' })[0].WHY.leading, " usually white" ;
62
+ is Sheep.^attributes.grep ({ .name eq ' $!wool' })[0].WHY.trailing, " not very dirty" ;
49
63
is Sheep.^find_method(' roar' ).WHY.content, ' not too scary' ;
50
64
51
65
# | trailing space here
52
66
sub third {}
53
67
# = leading space here
54
- is &third.WHY.content, " trailing space here\n leading space here" ;
68
+ is &third.WHY.content, " trailing space here\n leading space here" ;
69
+ is &third.WHY.leading, " trailing space here" ;
70
+ is &third.WHY.trailing, " leading space here" ;
55
71
56
72
sub has-parameter (
57
73
# | before
@@ -60,13 +76,17 @@ sub has-parameter(
60
76
) {}
61
77
62
78
is &has-parameter.signature.params[0].WHY, " before\n after" ;
79
+ is &has-parameter.signature.params[0].WHY.leading, " before" ;
80
+ is &has-parameter.signature.params[0].WHY.trailing, " after" ;
63
81
64
82
sub has-parameter-as-well (
65
83
# | preceding
66
84
Str $param # = following
67
85
) {}
68
86
69
87
is &has-parameter-as -well.signature.params[0].WHY, " preceding\n following" ;
88
+ is &has-parameter-as -well.signature.params[0].WHY.leading, " preceding" ;
89
+ is &has-parameter-as -well.signature.params[0].WHY.trailing, " following" ;
70
90
71
91
sub so-many-params (
72
92
# | next param
@@ -75,3 +95,5 @@ sub so-many-params(
75
95
) {}
76
96
77
97
is &so-many-params.signature.params[0].WHY, " next param\n first param" ;
98
+ is &so-many-params.signature.params[0].WHY.leading, " next param" ;
99
+ is &so-many-params.signature.params[0].WHY.trailing, " first param" ;
0 commit comments