Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 30... Línea 30...
30
 * @copyright  2012 Petr Skoda {@link http://skodak.org}
30
 * @copyright  2012 Petr Skoda {@link http://skodak.org}
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 */
32
 */
33
class markdown_test extends \basic_testcase {
33
class markdown_test extends \basic_testcase {
Línea 34... Línea 34...
34
 
34
 
35
    public function test_paragraphs() {
35
    public function test_paragraphs(): void {
36
        $text = "one\n\ntwo";
36
        $text = "one\n\ntwo";
37
        $result = "<p>one</p>\n\n<p>two</p>\n";
37
        $result = "<p>one</p>\n\n<p>two</p>\n";
38
        $this->assertSame($result, markdown_to_html($text));
38
        $this->assertSame($result, markdown_to_html($text));
Línea 39... Línea 39...
39
    }
39
    }
40
 
40
 
41
    public function test_headings() {
41
    public function test_headings(): void {
42
        $text = "Header 1\n====================\n\n## Header 2";
42
        $text = "Header 1\n====================\n\n## Header 2";
43
        $result = "<h1>Header 1</h1>\n\n<h2>Header 2</h2>\n";
43
        $result = "<h1>Header 1</h1>\n\n<h2>Header 2</h2>\n";
Línea 44... Línea 44...
44
        $this->assertSame($result, markdown_to_html($text));
44
        $this->assertSame($result, markdown_to_html($text));
45
    }
45
    }
46
 
46
 
47
    public function test_lists() {
47
    public function test_lists(): void {
48
        $text = "* one\n* two\n* three\n";
48
        $text = "* one\n* two\n* three\n";
Línea 49... Línea 49...
49
        $result = "<ul>\n<li>one</li>\n<li>two</li>\n<li>three</li>\n</ul>\n";
49
        $result = "<ul>\n<li>one</li>\n<li>two</li>\n<li>three</li>\n</ul>\n";
50
        $this->assertSame($result, markdown_to_html($text));
50
        $this->assertSame($result, markdown_to_html($text));
51
    }
51
    }
52
 
52
 
53
    public function test_links() {
53
    public function test_links(): void {
Línea 54... Línea 54...
54
        $text = "some [example link](http://example.com/)";
54
        $text = "some [example link](http://example.com/)";
55
        $result = "<p>some <a href=\"http://example.com/\">example link</a></p>\n";
55
        $result = "<p>some <a href=\"http://example.com/\">example link</a></p>\n";
56
        $this->assertSame($result, markdown_to_html($text));
56
        $this->assertSame($result, markdown_to_html($text));
57
    }
57
    }
58
 
58
 
59
    public function test_tabs() {
59
    public function test_tabs(): void {