| 1 | package Mason::t::Sections; | ||
| 2 | 1 | $Mason::t::Sections::VERSION = '2.24'; | |
| 3 | 1 | ▶ | use Test::Class::Most parent => 'Mason::Test::Class'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | sub test_sections : Tests { |
|
Subroutine
test_sections: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 6 | 1 | my $self = shift; | |
| 7 | 1 | $self->test_comp( | |
| 8 | src => <<'EOF', | ||
| 9 | <%doc> | ||
| 10 | This should not get printed. | ||
| 11 | </%doc> | ||
| 12 | |||
| 13 | <%init> | ||
| 14 | my $init_message = $self->init_message(); | ||
| 15 | </%init> | ||
| 16 | |||
| 17 | <%class> | ||
| 18 | my $class_message = "class message"; | ||
| 19 | method init_message () { "init message" } | ||
| 20 | </%class> | ||
| 21 | |||
| 22 | <BODY> | ||
| 23 | <% $class_message %> | ||
| 24 | % $self->method_call(); | ||
| 25 | <% $self->method_call_with_arglist(3, 4) %> | ||
| 26 | <%perl> | ||
| 27 | print "$init_message\n"; | ||
| 28 | </%perl> | ||
| 29 | </BODY> | ||
| 30 | |||
| 31 | <%method method_call> | ||
| 32 | <% $message %> | ||
| 33 | |||
| 34 | <%init> | ||
| 35 | my $message = "message"; | ||
| 36 | </%init> | ||
| 37 | </%method> | ||
| 38 | |||
| 39 | <%before method_call> | ||
| 40 | before method call | ||
| 41 | </%before> | ||
| 42 | |||
| 43 | <%after method_call> | ||
| 44 | after method call | ||
| 45 | </%after> | ||
| 46 | |||
| 47 | <%override render> | ||
| 48 | start override | ||
| 49 | <% super() %> | ||
| 50 | end override | ||
| 51 | </%override> | ||
| 52 | |||
| 53 | <%method method_call_with_arglist ($foo, $bar)> | ||
| 54 | <% $foo %> - <% $bar %> | ||
| 55 | </%method> | ||
| 56 | |||
| 57 | EOF | ||
| 58 | expect => <<'EOF', | ||
| 59 | start override | ||
| 60 | <BODY> | ||
| 61 | class message | ||
| 62 | |||
| 63 | before method call | ||
| 64 | |||
| 65 | message | ||
| 66 | |||
| 67 | after method call | ||
| 68 | |||
| 69 | 3 - 4 | ||
| 70 | init message | ||
| 71 | </BODY> | ||
| 72 | |||
| 73 | end override | ||
| 74 | EOF | ||
| 75 | ); | ||
| 76 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 77 | |||
| 78 | 1 | ▶ | sub test_perl_section_newlines : Tests { |
|
Subroutine
test_perl_section_newlines: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 79 | 1 | my $self = shift; | |
| 80 | 1 | $self->test_comp( | |
| 81 | src => <<'EOF', | ||
| 82 | 1<%perl>print "2\n";</%perl> | ||
| 83 | <%perl> | ||
| 84 | print "3\n"; | ||
| 85 | </%perl> | ||
| 86 | |||
| 87 | 4 | ||
| 88 | |||
| 89 | <%perl> | ||
| 90 | print "5\n"; | ||
| 91 | </%perl> | ||
| 92 | |||
| 93 | |||
| 94 | 6 | ||
| 95 | |||
| 96 | |||
| 97 | <%perl> | ||
| 98 | print "7\n"; | ||
| 99 | </%perl> | ||
| 100 | EOF | ||
| 101 | expect => <<'EOF', | ||
| 102 | 12 | ||
| 103 | 3 | ||
| 104 | 4 | ||
| 105 | 5 | ||
| 106 | |||
| 107 | 6 | ||
| 108 | |||
| 109 | 7 | ||
| 110 | EOF | ||
| 111 | ); | ||
| 112 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 113 | |||
| 114 | 1 | ▶ | sub test_text_section : Tests { |
|
Subroutine
test_text_section: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 115 | 1 | my $self = shift; | |
| 116 | 1 | $self->test_comp( | |
| 117 | src => <<'EOF', | ||
| 118 | <%text> | ||
| 119 | % | ||
| 120 | <%init> | ||
| 121 | <%doc> | ||
| 122 | <% $x %> | ||
| 123 | </%text> | ||
| 124 | EOF | ||
| 125 | expect => <<'EOF', | ||
| 126 | |||
| 127 | % | ||
| 128 | <%init> | ||
| 129 | <%doc> | ||
| 130 | <% $x %> | ||
| 131 | EOF | ||
| 132 | ); | ||
| 133 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 134 | |||
| 135 | 1 | ▶ | sub test_empty_sections : Tests { |
|
Subroutine
test_empty_sections: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 136 | 1 | my $self = shift; | |
| 137 | 1 | $self->test_comp( | |
| 138 | src => ' | ||
| 139 | hi | ||
| 140 | <%after foo></%after> | ||
| 141 | <%around foo></%around> | ||
| 142 | <%before foo></%before> | ||
| 143 | <%method foo></%method> | ||
| 144 | <%filter bar></%filter> | ||
| 145 | <%override allow_path_info></%override> | ||
| 146 | <%class></%class> | ||
| 147 | <%doc></%doc> | ||
| 148 | <%flags></%flags> | ||
| 149 | <%init></%init> | ||
| 150 | <%perl></%perl> | ||
| 151 | <%text></%text> | ||
| 152 | bye | ||
| 153 | ', | ||
| 154 | expect => "hibye", | ||
| 155 | ); | ||
| 156 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 157 | |||
| 158 | 1 | 1; | |