Skip to content

Commit

Permalink
Check definedness of trailing properties if none are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
hoelzro committed Jul 16, 2014
1 parent d222e79 commit c529aad
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion S26-documentation/why-leading.t
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use Test;
plan 38;
plan 56;

#| simple case
class Simple {
}

is Simple.WHY.content, 'simple case';
is Simple.WHY.leading, 'simple case';
ok !Simple.WHY.trailing.defined;
is ~Simple.WHY, 'simple case', 'stringifies correctly';

#| giraffe
Expand All @@ -18,8 +19,10 @@ class Outer {

is Outer.WHY.content, 'giraffe';
is Outer.WHY.leading, 'giraffe';
ok !Outer.WHY.trailing.defined;
is Outer::Inner.WHY.content, 'zebra';
is Outer::Inner.WHY.leading, 'zebra';
ok !Outer::Inner.WHY.trailing.defined;

#| a module
module foo {
Expand All @@ -33,20 +36,25 @@ module foo {

is foo.WHY.content, 'a module';
is foo.WHY.leading, 'a module';
ok !foo.WHY.trailing.defined;
is foo::bar.WHY.content, 'a package';
is foo::bar.WHY.leading, 'a package';
ok !foo::bar.WHY.trailing.defined;
is foo::bar::baz.WHY.content, 'and a class';
is foo::bar::baz.WHY.leading, 'and a class';
ok !foo::bar::baz.WHY.trailing.defined;

#| yellow
sub marine {}
is &marine.WHY.content, 'yellow';
is &marine.WHY.leading, 'yellow';
ok !&marine.WHY.trailing.defined;

#| pink
sub panther {}
is &panther.WHY.content, 'pink';
is &panther.WHY.leading, 'pink';
ok !&panther.WHY.trailing.defined;

#| a sheep
class Sheep {
Expand All @@ -59,10 +67,13 @@ class Sheep {

is Sheep.WHY.content, 'a sheep';
is Sheep.WHY.leading, 'a sheep';
ok !Sheep.WHY.trailing.defined;
is Sheep.^attributes.grep({ .name eq '$!wool' })[0].WHY, 'usually white';
is Sheep.^attributes.grep({ .name eq '$!wool' })[0].WHY.leading, 'usually white';
ok !Sheep.^attributes.grep({ .name eq '$!wool' })[0].WHY.trailing.defined;
is Sheep.^find_method('roar').WHY.content, 'not too scary';
is Sheep.^find_method('roar').WHY.leading, 'not too scary';
ok !Sheep.^find_method('roar').WHY.trailing.defined;

sub routine {}
is &routine.WHY.defined, False;
Expand All @@ -71,6 +82,7 @@ is &routine.WHY.defined, False;
our sub oursub {}
is &oursub.WHY, 'our works too', 'works for our subs';
is &oursub.WHY.leading, 'our works too', 'works for our subs';
ok !&oursub.WHY.trailing.defined;

# two subs in a row

Expand All @@ -81,8 +93,10 @@ sub one {}
sub two {}
is &one.WHY.content, 'one';
is &one.WHY.leading, 'one';
ok !&one.WHY.trailing.defined;
is &two.WHY.content, 'two';
is &two.WHY.leading, 'two';
ok !&two.WHY.trailing.defined;

#| that will break
sub first {}
Expand All @@ -92,13 +106,16 @@ sub second {}

is &first.WHY.content, 'that will break';
is &first.WHY.leading, 'that will break';
ok !&first.WHY.trailing.defined;
is &second.WHY.content, 'that will break';
is &second.WHY.leading, 'that will break';
ok !&second.WHY.trailing.defined;

#| trailing space here
sub third {}
is &third.WHY.content, 'trailing space here';
is &third.WHY.leading, 'trailing space here';
ok !&third.WHY.trailing.defined;

sub has-parameter(
#| documented
Expand All @@ -107,3 +124,4 @@ sub has-parameter(

is &has-parameter.signature.params[0].WHY, 'documented';
is &has-parameter.signature.params[0].WHY.leading, 'documented';
ok !&has-parameter.signature.params[0].WHY.trailing.defined;

0 comments on commit c529aad

Please sign in to comment.