8 use lib $Bin, "$Bin/t";
15 name => 'non-table (missing extra character)',
16 filter_elements => 'Org::Element::Table',
24 name => 'table basic tests',
25 filter_elements => 'Org::Element::Table',
27 #+CAPTION: test caption
33 | one <2011-03-17 > three
36 test_after_parse => sub {
38 my $doc = $args{result};
39 my $elems = $args{elements};
41 my ($r1, $r2, $r3, $r4, $r5) = @{ $t->children };
42 isa_ok($r1, "Org::Element::TableRow");
43 isa_ok($r2, "Org::Element::TableVLine");
44 isa_ok($r3, "Org::Element::TableRow");
45 isa_ok($r4, "Org::Element::TableRow");
47 my $c1a = $r1->children->[0];
48 isa_ok($c1a, "Org::Element::TableCell");
49 isa_ok($c1a->children->[0], "Org::Element::Text");
51 is($c1a->as_string, "a", "first cell's as_string");
52 is($r1->as_string, "|a|b|c\n", "first row's as_string");
54 # test inline elements inside cell
55 my $c5a = $r5->children->[0];
56 isa_ok($c5a->children->[0], "Org::Element::Text");
57 isa_ok($c5a->children->[1], "Org::Element::Timestamp");
58 isa_ok($c5a->children->[2], "Org::Element::Text");
60 is($t->row_count, 4, "row_count() method");
61 is($t->column_count, 3, "column_count() method");
62 isa_ok($t->rows->[0], "Org::Element::TableRow");
63 isa_ok($t->rows->[0]->cells->[0], 'Org::Element::TableCell');
65 is_deeply($r1->as_array, ["a", "b", "c"], "row's as_array() method")
66 or diag explain $r1->as_array;
71 ["one <2011-03-17 Thu> three"]],
72 "table's as_aoa() method")
73 or diag explain $t->as_aoa;