| 1 | # | ||
| 2 | # Copyright (c) 2015-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::Show::t | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | Run by test suite | ||
| 19 | |||
| 20 | =head1 NOTE | ||
| 21 | |||
| 22 | This is alpha software! Read the status section in the package README | ||
| 23 | or on the L<website|http://functional-perl.org/>. | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | package FP::Show::t; | ||
| 28 | |||
| 29 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | 1 | ▶ | use warnings FATAL => 'uninitialized'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 32 | |||
| 33 | 1 | ▶ | use Chj::TEST; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | |||
| 35 | 1 | ▶ | use FP::Show; # exports 'show' |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | 1 | ▶ | use FP::List ":all"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | 1 | ▶ | use FP::Stream ":all"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 38 | 1 | ▶ | use FP::Ops qw(regex_substitute); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 39 | |||
| 40 | 1 | ▶ | TEST_EXCEPTION { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 41 | 1 | my $l = list 100 - 1, "bottles"; | |
| 42 | 1 | die "not what we wanted: " . show($l) | |
| 43 | } | ||
| 44 | 1 | "not what we wanted: list(99, 'bottles')"; | |
| 45 | |||
| 46 | 1 | ▶ | TEST { show cons 1, cons 2, 3 } |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 47 | 1 | 'improper_list(1, 2, 3)'; | |
| 48 | |||
| 49 | 1 | ▶ | TEST { show improper_list(list(1, 3), 2) } |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 50 | 1 | 'improper_list(list(1, 3), 2)'; | |
| 51 | |||
| 52 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.4
| |||
| 53 | 1 | ▶ | regex_substitute sub {s/line \d+/line .../g}, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 54 | 0 | ▶ | show improper_list([1, 3], { foo => list("bar", sub {"f"}) }) |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 55 | } | ||
| 56 | 1 | "improper_list([1, 3], +{foo => list('bar', sub { 'DUMMY' })})"; | |
| 57 | |||
| 58 | 1 | my $s; | |
| 59 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 60 | 1 | $s = stream_iota->take(10); | |
| 61 | 1 | show $s | |
| 62 | } | ||
| 63 | 1 | "lazyT { 'DUMMY' } 'FP::List::List'"; | |
| 64 | |||
| 65 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 66 | 1 | $s->rest->rest; | |
| 67 | 1 | show $s | |
| 68 | } | ||
| 69 | 1 | "improper_list(0, 1, lazyT { 'DUMMY' } 'FP::List::List')"; | |
| 70 | |||
| 71 | 1 | ▶ | TEST { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 72 | show * STDERR {IO} | ||
| 73 | 1 | } | |
| 74 | 1 | "bless(IO(2), 'IO::File')"; | |
| 75 | |||
| 76 | 1 | 1 | |