From f2bbf30b71b15efa7a918944b4ffc74f8b1747a9 Mon Sep 17 00:00:00 2001 From: Guy Brand Date: Wed, 31 Jul 2013 11:38:44 +0200 Subject: Simple test cases for code and file token fix --- _test/tests/inc/parser/parser_file.test.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 _test/tests/inc/parser/parser_file.test.php (limited to '_test/tests/inc/parser/parser_file.test.php') diff --git a/_test/tests/inc/parser/parser_file.test.php b/_test/tests/inc/parser/parser_file.test.php new file mode 100644 index 000000000..924b00382 --- /dev/null +++ b/_test/tests/inc/parser/parser_file.test.php @@ -0,0 +1,28 @@ +P->addMode('file',new Doku_Parser_Mode_File()); + } + + function testFile() { + $this->P->parse('Foo Test Bar'); + $calls = array ( + array('document_start',array()), + array('p_open',array()), + array('cdata',array("\n".'Foo ')), + array('p_close',array()), + array('file',array('Test',null,null)), + array('p_open',array()), + array('cdata',array(' Bar')), + array('p_close',array()), + array('document_end',array()), + ); + $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); + } + +} + -- cgit v1.2.3 From fdd9bab63c332a19e213c2cf7c986b8b95e25af6 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Thu, 1 Aug 2013 11:37:00 +0200 Subject: increase test coverage for code and file code - test correct recognition of downloadable filename token file - test correct recognition of syntax name & downloadable filename tokens --- _test/tests/inc/parser/parser_file.test.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to '_test/tests/inc/parser/parser_file.test.php') diff --git a/_test/tests/inc/parser/parser_file.test.php b/_test/tests/inc/parser/parser_file.test.php index 924b00382..39bda8a58 100644 --- a/_test/tests/inc/parser/parser_file.test.php +++ b/_test/tests/inc/parser/parser_file.test.php @@ -24,5 +24,33 @@ class TestOfDoku_Parser_File extends TestOfDoku_Parser { $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } + function testFileHighlightDownload() { + $this->P->parse('Foo Test Bar'); + $calls = array ( + array('document_start',array()), + array('p_open',array()), + array('cdata',array("\n".'Foo ')), + array('p_close',array()), + array('file',array('Test','txt','test.txt')), + array('p_open',array()), + array('cdata',array(' Bar')), + array('p_close',array()), + array('document_end',array()), + ); + $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); + } + + function testFileToken() { + $this->P->parse('Foo Test Bar'); + $calls = array ( + array('document_start',array()), + array('p_open',array()), + array('cdata',array("\n".'Foo Test Bar')), + array('p_close',array()), + array('document_end',array()), + ); + $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); + } + } -- cgit v1.2.3