Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (36 sloc) 0.939 kb
use Test::More tests => 12;
use strict;
use DataFlow;
use DataFlow::Proc;
# each call = 2 tests
sub test_uc_with {
my $flow = dataflow @_;
ok( $flow, q{test_uc_wth(} . join( q{,}, @_ ) . q{)} );
my @res = $flow->process('abcdef');
is( $res[0], 'ABCDEF', '...and returns the right value' );
}
my $uc = sub { uc };
my $proc = DataFlow::Proc->new( p => $uc );
my $flow = DataFlow->new( procs => [$proc] );
my $nested = DataFlow->new( [$flow] );
# proc
test_uc_with($proc);
# code
test_uc_with($uc);
# flow
test_uc_with($flow);
# nested
test_uc_with($nested);
# string
test_uc_with('UC');
# each call = 2 tests
sub test_ucf_with {
my $flow = dataflow @_;
ok( $flow, q{test_ucf_wth(} . join( q{,}, @_ ) . q{)} );
my @res = $flow->process('abcdef');
is( $res[0], 'Abcdef' );
}
my $ucfirst = sub { ucfirst };
my @mix = ( $nested, $flow, $proc, 'UC', sub { lc }, $ucfirst );
# mix
test_ucf_with(@mix);
Jump to Line
Something went wrong with that request. Please try again.