| File: | t/TmplToken.t |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | time | code |
|---|---|---|---|---|---|---|
| 1 | #!/usr/bin/perl | |||||
| 2 | # | |||||
| 3 | # This Koha test module is a stub! | |||||
| 4 | # Add more tests here!!! | |||||
| 5 | ||||||
| 6 | 1 1 1 | 1.33283541340686e+15 2 24 | use strict; | |||
| 7 | 1 1 1 | 4 1 29 | use warnings; | |||
| 8 | 1 1 1 | 489 2 68 | use C4::TmplTokenType; | |||
| 9 | 1 1 1 | 210 21225 31 | use Test::More tests => 19; | |||
| 10 | ||||||
| 11 | BEGIN { | |||||
| 12 | 1 | 1782 | use_ok('C4::TmplToken'); | |||
| 13 | } | |||||
| 14 | ||||||
| 15 | 1 | 209681 | ok (my $token = C4::TmplToken->new('test',C4::TmplTokenType::TEXT,10,'/tmp/translate.txt'), "Create new"); | |||
| 16 | 1 | 775 | ok ($token->string eq 'test', "String works"); | |||
| 17 | 1 | 456 | ok ($token->type == C4::TmplTokenType::TEXT, "Token works"); | |||
| 18 | 1 | 451 | ok ($token->line_number == 10, "Line number works"); | |||
| 19 | 1 | 456 | ok ($token->pathname eq '/tmp/translate.txt', "Path works"); | |||
| 20 | ||||||
| 21 | ||||||
| 22 | 1 | 419 | ok ($token->text_p, "text_p works"); | |||
| 23 | ||||||
| 24 | 1 | 454 | is($token-> children(), undef, "testing children returns undef when given argument"); | |||
| 25 | ||||||
| 26 | 1 | 254 | ok($token-> set_children(), "testing set_children with no arguments"); | |||
| 27 | ||||||
| 28 | 1 | 333 | is($token-> parameters_and_fields(), "0", "testing Parameters and fields returns 0 when given argument"); | |||
| 29 | ||||||
| 30 | 1 | 662 | is($token-> anchors(), "0", "testing anchors returns 0 when given argument"); | |||
| 31 | ||||||
| 32 | 1 | 505 | is($token-> form(),undef, "testing form returns undef when given argument"); | |||
| 33 | ||||||
| 34 | 1 | 424 | ok($token-> set_form(), "testing set_form with no arguments"); | |||
| 35 | ||||||
| 36 | 1 | 596 | is($token-> js_data(),undef, "testing form returns undef when given argument"); | |||
| 37 | ||||||
| 38 | 1 | 421 | ok($token-> set_js_data(), "testing set_js_data with no arguments"); | |||
| 39 | ||||||
| 40 | 1 | 435 | is($token-> tag_p(),"", "testing tag_p returns '' when given argument"); | |||
| 41 | ||||||
| 42 | 1 | 715 | is($token-> cdata_p(),"", "testing cdata_p returns '' when given argument"); | |||
| 43 | ||||||
| 44 | 1 | 625 | is($token-> text_parametrized_p(),"", "testing text_parametrized returns '' when given argument"); | |||
| 45 | ||||||
| 46 | 1 | 599 | is($token-> directive_p(),"", "testing directive_p returns '' when given argument"); | |||