summaryrefslogtreecommitdiff
path: root/_test/tests/inc/parser
diff options
context:
space:
mode:
authorGerrit Uitslag <klapinklapin@gmail.com>2013-10-18 07:15:46 -0700
committerGerrit Uitslag <klapinklapin@gmail.com>2013-10-18 07:15:46 -0700
commit57a6f99d09d3662a8a2ad72e312aa6f53bcc2d01 (patch)
tree51bbb609a7efd89e38dd0e3d8fbd8d8158f5753b /_test/tests/inc/parser
parentf05a1cc5fcdb4c2b6ee3cbf499f980f800dbd105 (diff)
parente0328e30d24321e319e2733192bf829b9000c5eb (diff)
downloadrpg-57a6f99d09d3662a8a2ad72e312aa6f53bcc2d01.tar.gz
rpg-57a6f99d09d3662a8a2ad72e312aa6f53bcc2d01.tar.bz2
Merge pull request #390 from splitbrain/tablethead_chris
multi-row THEAD & tests
Diffstat (limited to '_test/tests/inc/parser')
-rw-r--r--_test/tests/inc/parser/parser_table.test.php221
1 files changed, 196 insertions, 25 deletions
diff --git a/_test/tests/inc/parser/parser_table.test.php b/_test/tests/inc/parser/parser_table.test.php
index 5258afe3d..d4596bc8a 100644
--- a/_test/tests/inc/parser/parser_table.test.php
+++ b/_test/tests/inc/parser/parser_table.test.php
@@ -44,7 +44,7 @@ def');
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
function testTableWinEOL() {
@@ -84,7 +84,7 @@ def');
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
function testEmptyTable() {
@@ -109,7 +109,7 @@ def');
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
function testTableHeaders() {
@@ -125,7 +125,6 @@ def');
array('cdata',array("\n\nabc")),
array('p_close',array()),
array('table_open',array(3, 1, 6)),
- array('tablethead_open',array()),
array('tablerow_open',array()),
array('tableheader_open',array(1,NULL,1)),
array('cdata',array(' X ')),
@@ -137,7 +136,6 @@ def');
array('cdata',array(' Z ')),
array('tableheader_close',array()),
array('tablerow_close',array()),
- array('tablethead_close',array()),
array('table_close',array(19)),
array('p_open',array()),
array('cdata',array('def')),
@@ -145,16 +143,15 @@ def');
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
- function testTableHeadersMultilines() {
+ function testTableHead() {
$this->P->addMode('table',new Doku_Parser_Mode_Table());
$this->P->parse('
abc
-^ X | Y ^ Z |
-| A | B | C |
+^ X ^ Y ^ Z ^
def');
$calls = array (
@@ -162,20 +159,70 @@ def');
array('p_open',array()),
array('cdata',array("\n\nabc")),
array('p_close',array()),
- array('table_open',array(3, 2, 6)),
+ array('table_open',array(3, 1, 6)),
array('tablethead_open',array()),
array('tablerow_open',array()),
array('tableheader_open',array(1,NULL,1)),
array('cdata',array(' X ')),
array('tableheader_close',array()),
- array('tablecell_open',array(1,NULL,1)),
+ array('tableheader_open',array(1,NULL,1)),
array('cdata',array(' Y ')),
- array('tablecell_close',array()),
+ array('tableheader_close',array()),
array('tableheader_open',array(1,NULL,1)),
array('cdata',array(' Z ')),
array('tableheader_close',array()),
array('tablerow_close',array()),
array('tablethead_close',array()),
+ array('table_close',array(19)),
+ array('p_open',array()),
+ array('cdata',array('def')),
+ array('p_close',array()),
+ array('document_end',array()),
+ );
+
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
+
+ }
+
+ function testTableHeadMultiline() {
+ $this->P->addMode('table',new Doku_Parser_Mode_Table());
+ $this->P->parse('
+abc
+^ X1 ^ Y1 ^ Z1 ^
+^ X2 ^ Y2 ^ Z2 ^
+| A | B | C |
+def');
+
+ $calls = array (
+ array('document_start',array()),
+ array('p_open',array()),
+ array('cdata',array("\n\nabc")),
+ array('p_close',array()),
+ array('table_open',array(3, 3, 6)),
+ array('tablethead_open',array()),
+ array('tablerow_open',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' X1 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' Y1 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' Z1 ')),
+ array('tableheader_close',array()),
+ array('tablerow_close',array()),
+ array('tablerow_open',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' X2 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' Y2 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' Z2 ')),
+ array('tableheader_close',array()),
+ array('tablerow_close',array()),
+ array('tablethead_close',array()),
array('tablerow_open',array()),
array('tablecell_open',array(1,NULL,1)),
array('cdata',array(' A ')),
@@ -187,14 +234,14 @@ def');
array('cdata',array(' C ')),
array('tablecell_close',array()),
array('tablerow_close',array()),
- array('table_close',array(33)),
+ array('table_close',array(53)),
array('p_open',array()),
array('cdata',array('def')),
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
@@ -229,7 +276,7 @@ def');
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
function testCellSpan() {
@@ -271,7 +318,7 @@ def');
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
function testCellRowSpan() {
@@ -319,7 +366,7 @@ def');
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
function testCellRowSpanFirstRow() {
@@ -377,9 +424,134 @@ def');
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
+ function testRowSpanTableHead() {
+ $this->P->addMode('table',new Doku_Parser_Mode_Table());
+ $this->P->parse('
+abc
+^ X1 ^ Y1 ^ Z1 ^
+^ X2 ^ ::: ^ Z2 ^
+| A3 | B3 | C3 |
+def');
+
+ $calls = array (
+ array('document_start',array()),
+ array('p_open',array()),
+ array('cdata',array("\n\nabc")),
+ array('p_close',array()),
+ array('table_open',array(3, 3, 6)),
+ array('tablethead_open',array()),
+ array('tablerow_open',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' X1 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,2)),
+ array('cdata',array(' Y1 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' Z1 ')),
+ array('tableheader_close',array()),
+ array('tablerow_close',array()),
+ array('tablerow_open',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' X2 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' Z2 ')),
+ array('tableheader_close',array()),
+ array('tablerow_close',array()),
+ array('tablethead_close',array()),
+ array('tablerow_open',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' A3 ')),
+ array('tablecell_close',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' B3 ')),
+ array('tablecell_close',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' C3 ')),
+ array('tablecell_close',array()),
+ array('tablerow_close',array()),
+ array('table_close',array(57)),
+ array('p_open',array()),
+ array('cdata',array('def')),
+ array('p_close',array()),
+ array('document_end',array()),
+ );
+
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
+
+ }
+
+ function testRowSpanAcrossTableHeadBoundary() {
+ $this->P->addMode('table',new Doku_Parser_Mode_Table());
+ $this->P->parse('
+abc
+^ X1 ^ Y1 ^ Z1 ^
+^ X2 ^ ::: ^ Z2 ^
+| A3 | ::: | C3 |
+| A4 | ::: | C4 |
+def');
+
+ $calls = array (
+ array('document_start',array()),
+ array('p_open',array()),
+ array('cdata',array("\n\nabc")),
+ array('p_close',array()),
+ array('table_open',array(3, 4, 6)),
+ array('tablethead_open',array()),
+ array('tablerow_open',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' X1 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,2)),
+ array('cdata',array(' Y1 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' Z1 ')),
+ array('tableheader_close',array()),
+ array('tablerow_close',array()),
+ array('tablerow_open',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' X2 ')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array(' Z2 ')),
+ array('tableheader_close',array()),
+ array('tablerow_close',array()),
+ array('tablethead_close',array()),
+ array('tablerow_open',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' A3 ')),
+ array('tablecell_close',array()),
+ array('tablecell_open',array(1,NULL,2)),
+ array('cdata',array('')),
+ array('tablecell_close',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' C3 ')),
+ array('tablecell_close',array()),
+ array('tablerow_close',array()),
+ array('tablerow_open',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' A4 ')),
+ array('tablecell_close',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' C4 ')),
+ array('tablecell_close',array()),
+ array('tablerow_close',array()),
+ array('table_close',array(76)),
+ array('p_open',array()),
+ array('cdata',array('def')),
+ array('p_close',array()),
+ array('document_end',array()),
+ );
+
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
+
+ }
+
function testCellAlignmentFormatting() {
$this->P->addMode('table',new Doku_Parser_Mode_Table());
$this->P->addMode('strong',new Doku_Parser_Mode_Formatting('strong'));
@@ -416,7 +588,7 @@ def');
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
@@ -462,7 +634,7 @@ def');
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
// This is really a failing test - formatting able to spread across cols
@@ -517,7 +689,7 @@ def');
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
// This is really a failing test - unformatted able to spread across cols
@@ -568,7 +740,7 @@ def');
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
function testTableLinebreak() {
@@ -616,7 +788,7 @@ def');
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
// This is really a failing test - footnote able to spread across cols
@@ -675,7 +847,6 @@ def');
array('p_close',array()),
array('document_end',array()),
);
- $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ $this->assertEquals($calls,array_map('stripbyteindex',$this->H->calls));
}
}
-