| 1 | # | ||
| 2 | # Copyright (c) 2019-2021 Christian Jaeger, copying@christianjaeger.ch | ||
| 3 | # | ||
| 4 | # This is free software, offered under either the same terms as perl 5 | ||
| 5 | # or the terms of the Artistic License version 2 or the terms of the | ||
| 6 | # MIT License (Expat version). See the file COPYING.md that came | ||
| 7 | # bundled with this file. | ||
| 8 | # | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | FP::Docstring::t -- tests for FP::Docstring | ||
| 13 | |||
| 14 | =head1 SEE ALSO | ||
| 15 | |||
| 16 | L<FP::Docstring> | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | package FP::Docstring::t; | ||
| 21 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | 1 | ▶ | use warnings FATAL => 'uninitialized'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | 1 | ▶ | use Exporter "import"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | 1 | our @EXPORT = qw(); | |
| 28 | 1 | our @EXPORT_OK = qw(); | |
| 29 | 1 | our %EXPORT_TAGS = (all => [@EXPORT, @EXPORT_OK]); | |
| 30 | |||
| 31 | 1 | ▶ | use FP::Docstring; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 32 | 1 | ▶ | use Chj::TEST; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 33 | |||
| 34 | # try to trick the parser: | ||
| 35 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=2.6
| |||
| 36 | 0 | ▶ | docstring(sub { __ "hi\');"; $_[0] + 1 }) |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 37 | 1 | } | |
| 38 | 1 | 'hi\');'; | |
| 39 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=2.6
| |||
| 40 | 0 | ▶ | docstring(sub { __ "hi\");"; $_[0] + 1 }) |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 41 | 1 | } | |
| 42 | 1 | 'hi");'; | |
| 43 | |||
| 44 | # get the quoting right: | ||
| 45 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=2.6
| |||
| 46 | 0 | ▶ | docstring(sub { __ '($foo) -> hash'; $_[0] + 1 }) |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 47 | 1 | } | |
| 48 | 1 | '($foo) -> hash'; | |
| 49 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=2.6
| |||
| 50 | 0 | ▶ | docstring(sub { __ '("$foo")'; $_[0] + 1 }) |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 51 | 1 | } | |
| 52 | 1 | '("$foo")'; | |
| 53 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=2.6
| |||
| 54 | 0 | ▶ | docstring(sub { __ '(\'$foo\')'; $_[0] + 1 }) |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 55 | 1 | } | |
| 56 | 1 | '(\'$foo\')'; | |
| 57 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=2.6
| |||
| 58 | 0 | ▶ | docstring sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 59 | 0 | __ '($str, $token, {tokenargument => $value,..})-> $str | |
| 60 | re-insert hidden parts'; | ||
| 61 | 0 | 1 | |
| 62 | } | ||
| 63 | 1 | } | |
| 64 | 1 | '($str, $token, {tokenargument => $value,..})-> $str | |
| 65 | re-insert hidden parts'; | ||
| 66 | |||
| 67 | 1 | 1 | |