Revision e87f225c
Von Bernd Blessmann vor etwa 11 Jahren hinzugefügt
t/helper/csv.t | ||
---|---|---|
1 |
use Test::More tests => 56;
|
|
1 |
use Test::More tests => 58;
|
|
2 | 2 |
|
3 | 3 |
use lib 't'; |
4 | 4 |
use utf8; |
... | ... | |
446 | 446 |
$csv->parse; |
447 | 447 |
is_deeply $csv->get_data, [ { description => 'Kaffee' } ], 'without profile and class works'; |
448 | 448 |
|
449 |
###### |
|
450 |
|
|
451 |
$csv = SL::Helper::Csv->new( |
|
452 |
file => \<<EOL, |
|
453 |
datatype;description |
|
454 |
"datatype;name |
|
455 |
P;Kaffee |
|
456 |
C;Meier |
|
457 |
P;Beer |
|
458 |
EOL |
|
459 |
# " # make emacs happy |
|
460 |
profile => [ |
|
461 |
{class => 'SL::DB::Part', row_ident => 'P'}, |
|
462 |
{class => 'SL::DB::Customer', row_ident => 'C'}, |
|
463 |
], |
|
464 |
ignore_unknown_columns => 1, |
|
465 |
); |
|
466 |
is $csv->parse, undef, 'multiplex: broken csv header won\'t get parsed'; |
|
467 |
|
|
468 |
###### |
|
469 |
|
|
470 |
$csv = SL::Helper::Csv->new( |
|
471 |
file => \<<EOL, |
|
472 |
datatype;description |
|
473 |
P;Kaffee |
|
474 |
C;Meier |
|
475 |
P;Beer |
|
476 |
EOL |
|
477 |
# " # make emacs happy |
|
478 |
profile => [ |
|
479 |
{class => 'SL::DB::Part', row_ident => 'P'}, |
|
480 |
{class => 'SL::DB::Customer', row_ident => 'C'}, |
|
481 |
], |
|
482 |
header => [ [], ['name'] ], |
|
483 |
ignore_unknown_columns => 1, |
|
484 |
); |
|
485 |
ok !$csv->_check_multiplexed, 'multiplex check detects empty header'; |
|
486 |
|
|
487 |
|
|
449 | 488 |
# vim: ft=perl |
450 | 489 |
# set emacs to perl mode |
451 | 490 |
# Local Variables: |
452 | 491 |
# mode: perl |
453 | 492 |
# End: |
493 |
|
Auch abrufbar als: Unified diff
weitere multiplex-Tests