| CODENOTIFIER | HelpYou are not signed inSign in |
Project: BlueCloth
Revision: 74
Author: ged
Date: 12 May 2005 15:48:27
Diff at Trac: http://www.deveiate.org/projects/BlueCloth/changeset/74
Changes:- Added tests to make sure I dont break lists trying to fix #15
- Added tests for Markdown 1.0.1 syntax (#18).
| ... | ...@@ -3,7 +3,7 @@ | |
| 3 | 3 | # Test case for BlueCloth Markdown transforms. |
| 4 | 4 | # $Id: TEMPLATE.rb.tpl,v 1.2 2003/09/11 04:59:51 deveiant Exp $ |
| 5 | 5 | # |
| 6 | # Copyright (c) 2004 The FaerieMUD Consortium. | |
| 6 | # Copyright (c) 2004, 2005 The FaerieMUD Consortium. | |
| 7 | 7 | # |
| 8 | 8 | |
| 9 | 9 | if !defined?( BlueCloth ) || !defined?( BlueCloth::TestCase ) |
| ... | ...@@ -12,8 +12,8 @@ | |
| 12 | 12 | end |
| 13 | 13 | |
| 14 | 14 | |
| 15 | ### This test case tests ... | |
| 16 | class SubfunctionsTestCase < BlueCloth::TestCase | |
| 15 | ### Test conformance to Markdown syntax specification | |
| 16 | class MarkdownTestCase < BlueCloth::TestCase | |
| 17 | 17 | |
| 18 | 18 | ### Test email address output |
| 19 | 19 | Emails = %w[ |
| ... | ...@@ -186,8 +186,19 @@ | |
| 186 | 186 | end |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | # Strip leading indent for prettier output of the code in debugging | |
| 190 | code.gsub!( /^\t{4}/, '' ) | |
| 191 | ||
| 192 | # Support debugging for individual tests | |
| 193 | olddb = nil | |
| 194 | if $DebugPattern && $DebugPattern =~ methname | |
| 195 | olddb = $DEBUG | |
| 196 | $DEBUG = true | |
| 197 | end | |
| 189 | 198 | |
| 190 | 199 | debugMsg "--- %s [%s]:\n%s\n---\n" % [sname, desc, code] |
| 200 | ||
| 201 | $DEBUG = olddb unless olddb.nil? | |
| 191 | 202 | eval code |
| 192 | 203 | end |
| 193 | 204 | |
| ... | ...@@ -655,6 +666,13 @@ | |
| 655 | 666 | <hr/> |
| 656 | 667 | >>> |
| 657 | 668 | |
| 669 | # Indented Hrule 1 | |
| 670 | <<< | |
| 671 | * * * | |
| 672 | --- Should become: | |
| 673 | <hr/> | |
| 674 | >>> | |
| 675 | ||
| 658 | 676 | # Hrule 2 |
| 659 | 677 | <<< |
| 660 | 678 | *** |
| ... | ...@@ -1183,6 +1201,15 @@ | |
| 1183 | 1201 | <p>An <a href="http://www.bluefi.com/">example</a> reference-style link.</p> |
| 1184 | 1202 | >>> |
| 1185 | 1203 | |
| 1204 | # Indented (less than tabwidth) reference-style link | |
| 1205 | <<< | |
| 1206 | An [example][ex] reference-style link. | |
| 1207 | ||
| 1208 | [ex]: http://www.bluefi.com/ | |
| 1209 | --- Should become: | |
| 1210 | <p>An <a href="http://www.bluefi.com/">example</a> reference-style link.</p> | |
| 1211 | >>> | |
| 1212 | ||
| 1186 | 1213 | # Reference-style link with quoted title |
| 1187 | 1214 | <<< |
| 1188 | 1215 | An [example][ex] reference-style link. |
| ... | ...@@ -1467,6 +1494,34 @@ | |
| 1467 | 1494 | </ol> |
| 1468 | 1495 | >>> |
| 1469 | 1496 | |
| 1497 | # Multi-paragraph list items followed by paragraph | |
| 1498 | <<< | |
| 1499 | 1. This is a list item with two paragraphs. Lorem ipsum dolor | |
| 1500 | sit amet, consectetuer adipiscing elit. Aliquam hendrerit | |
| 1501 | mi posuere lectus. | |
| 1502 | ||
| 1503 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet | |
| 1504 | vitae, risus. Donec sit amet nisl. Aliquam semper ipsum | |
| 1505 | sit amet velit. | |
| 1506 | ||
| 1507 | 2. Suspendisse id sem consectetuer libero luctus adipiscing. | |
| 1508 | ||
| 1509 | This is a following paragraph which shouldn't be part of the list. | |
| 1510 | --- Should become: | |
| 1511 | <ol> | |
| 1512 | <li><p>This is a list item with two paragraphs. Lorem ipsum dolor | |
| 1513 | sit amet, consectetuer adipiscing elit. Aliquam hendrerit | |
| 1514 | mi posuere lectus.</p> | |
| 1515 | ||
| 1516 | <p>Vestibulum enim wisi, viverra nec, fringilla in, laoreet | |
| 1517 | vitae, risus. Donec sit amet nisl. Aliquam semper ipsum | |
| 1518 | sit amet velit.</p></li> | |
| 1519 | <li><p>Suspendisse id sem consectetuer libero luctus adipiscing.</p></li> | |
| 1520 | </ol> | |
| 1521 | ||
| 1522 | <p>This is a following paragraph which shouldn't be part of the list.</p> | |
| 1523 | >>> | |
| 1524 | ||
| 1470 | 1525 | # Lazy multi-paragraphs |
| 1471 | 1526 | <<< |
| 1472 | 1527 | * This is a list item with two paragraphs. |
| ... | ...@@ -1525,3 +1580,106 @@ | |
| 1525 | 1580 | <p>1986. What a great season.</p> |
| 1526 | 1581 | >>> |
| 1527 | 1582 | |
| 1583 | ||
| 1584 | ### [1.0.1 changes] | |
| 1585 | ||
| 1586 | # Escapes in code blocks shouldn't be touched. | |
| 1587 | <<< | |
| 1588 | Markdown allows you to use backslash escapes to generate literal | |
| 1589 | characters which would otherwise have special meaning in Markdown's | |
| 1590 | formatting syntax. For example, if you wanted to surround a word with | |
| 1591 | literal asterisks (instead of an HTML `<em>` tag), you can backslashes | |
| 1592 | before the asterisks, like this: | |
| 1593 | ||
| 1594 | \*literal asterisks\* | |
| 1595 | ||
| 1596 | --- Should become: | |
| 1597 | <p>Markdown allows you to use backslash escapes to generate literal | |
| 1598 | characters which would otherwise have special meaning in Markdown's | |
| 1599 | formatting syntax. For example, if you wanted to surround a word with | |
| 1600 | literal asterisks (instead of an HTML <code><em></code> tag), you can backslashes | |
| 1601 | before the asterisks, like this:</p> | |
| 1602 | ||
| 1603 | <pre><code>\*literal asterisks\* | |
| 1604 | </code></pre> | |
| 1605 | >>> | |
| 1606 | ||
| 1607 | # Escapes in code spans shouldn't be touched | |
| 1608 | <<< | |
| 1609 | You can escape the splat operator by backslashing it like this: `/foo\*/`. | |
| 1610 | --- Should become: | |
| 1611 | <p>You can escape the splat operator by backslashing it like this: <code>/foo\*/</code>.</p> | |
| 1612 | >>> | |
| 1613 | ||
| 1614 | ||
| 1615 | # Reference-style links at or deeper than tab width are code blocks. | |
| 1616 | <<< | |
| 1617 | An [example][ex] reference-style link. | |
| 1618 | ||
| 1619 | [ex]: http://www.bluefi.com/ | |
| 1620 | --- Should become: | |
| 1621 | <p>An [example][ex] reference-style link.</p> | |
| 1622 | ||
| 1623 | <pre><code>[ex]: http://www.bluefi.com/ | |
| 1624 | </code></pre> | |
| 1625 | >>> | |
| 1626 | ||
| 1627 | # Inline links using < and > URL delimiters weren't working: | |
| 1628 | <<< | |
| 1629 | like [this](<http://example.com/>) | |
| 1630 | --- Should become: | |
| 1631 | <p>like <a href="http://example.com/">this</a></p> | |
| 1632 | >>> | |
| 1633 | ||
| 1634 | # HTML comment blocks should remain as-is | |
| 1635 | <<< | |
| 1636 | <!-- This is a comment --> | |
| 1637 | --- Should become: | |
| 1638 | <!-- This is a comment --> | |
| 1639 | >>> | |
| 1640 | ||
| 1641 | # Autolinks shouldn't affect code spans | |
| 1642 | <<< | |
| 1643 | like this: `<http://example.com/>` | |
| 1644 | --- Should become: | |
| 1645 | <p>like this: <code><http://example.com/></code></p> | |
| 1646 | >>> | |
| 1647 | ||
| 1648 | ||
| 1649 | # Lines in the middle of hard-wrapped paragraphs which look like the start of a | |
| 1650 | # list item would accidentally trigger the creation of a list. | |
| 1651 | <<< | |
| 1652 | I recommend upgrading to version | |
| 1653 | 8. Oops, now this line is treated | |
| 1654 | as a sub-list. | |
| 1655 | --- Should become: | |
| 1656 | <p>I recommend upgrading to version | |
| 1657 | 8. Oops, now this line is treated | |
| 1658 | as a sub-list.</p> | |
| 1659 | >>> | |
| 1660 | ||
| 1661 | ||
| 1662 | # Header + list + code | |
| 1663 | <<< | |
| 1664 | ## This is a header. | |
| 1665 | ||
| 1666 | 1. This is the first list item. | |
| 1667 | 2. This is the second list item. | |
| 1668 | ||
| 1669 | Here's some example code: | |
| 1670 | ||
| 1671 | return shell_exec("echo $input | $markdown_script"); | |
| 1672 | --- Should become: | |
| 1673 | <h2>This is a header.</h2> | |
| 1674 | ||
| 1675 | <ol> | |
| 1676 | <li>This is the first list item.</li> | |
| 1677 | <li>This is the second list item.</li> | |
| 1678 | </ol> | |
| 1679 | ||
| 1680 | <p>Here's some example code:</p> | |
| 1681 | ||
| 1682 | <pre><code>return shell_exec("echo $input | $markdown_script"); | |
| 1683 | </code></pre> | |
| 1684 | >>> | |
| 1685 |