# ParsePlaybill.t 20apr19waw use warnings; use strict; use Test::More 'no_plan'; use Test::NoWarnings; # use Data::Dump qw(dd); # for debug BEGIN { use_ok 'ParsePlaybill'; } my @Tests = ( [ "^46004 % Tamerlane.| Tamerlane - Sheridan; Bajazet - Barry; Moneses - A Gentleman; Arpasia - Mrs. Furnival; Selima - Mrs. Elmy; +\n", <<'EOT', "46004","Tamerlane","Tamerlane","Sheridan" "46004","Tamerlane","Bajazet","Barry" "46004","Tamerlane","Moneses","A Gentleman" "46004","Tamerlane","Arpasia","Mrs. Furnival" "46004","Tamerlane","Selima","Mrs. Elmy" EOT ], 'Polonius "fixed" in this test case', [ "^46005 % Hamlet.| Hamlet - Sheridan; Polonius - J. Morris; Laertes- Lacy; Ophelia- Mrs. Storer; Queen - Mrs. Furnival; +\n", <<'EOT', "46005","Hamlet","Hamlet","Sheridan" "46005","Hamlet","Polonius","J. Morris" "46005","Hamlet","Laertes","Lacy" "46005","Hamlet","Ophelia","Mrs. Storer" "46005","Hamlet","Queen","Mrs. Furnival" EOT ], 'one-character play', [ "^1 % Mark Twain Tonight .| Mark Twain -Hal Holbrook;+\n", <<'EOT', "1","Mark Twain Tonight","Mark Twain","Hal Holbrook" EOT ], ); VECTOR: for my $ar_vector (@Tests) { if (not ref $ar_vector) { note $ar_vector; next VECTOR; } my ($record, $expected) = @$ar_vector; my @fields = ParsePlaybill::rec $record; my $got = ParsePlaybill::fmt @fields; ok $got eq $expected, "$record" ; } # end for VECTOR