| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// Unit tests for markdown. | 5 /// Unit tests for markdown. |
| 6 #library('markdown_tests'); | 6 #library('markdown_tests'); |
| 7 | 7 |
| 8 #import('../lib.dart'); | 8 #import('../lib.dart'); |
| 9 | 9 |
| 10 // TODO(rnystrom): Better path to unittest. | 10 // TODO(rnystrom): Better path to unittest. |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 ''', ''' | 596 ''', ''' |
| 597 <p>before <code>can `contain` backticks</code> after</p> | 597 <p>before <code>can `contain` backticks</code> after</p> |
| 598 '''); | 598 '''); |
| 599 | 599 |
| 600 validate('double backticks with spaces', ''' | 600 validate('double backticks with spaces', ''' |
| 601 before `` `tick` `` after | 601 before `` `tick` `` after |
| 602 ''', ''' | 602 ''', ''' |
| 603 <p>before <code>`tick`</code> after</p> | 603 <p>before <code>`tick`</code> after</p> |
| 604 '''); | 604 '''); |
| 605 | 605 |
| 606 validate('multiline double backticks with spaces', ''' |
| 607 before ``in `tick` |
| 608 another`` after |
| 609 ''', ''' |
| 610 <p>before <code>in `tick` |
| 611 another</code> after</p> |
| 612 '''); |
| 613 |
| 606 validate('ignore markup inside code', ''' | 614 validate('ignore markup inside code', ''' |
| 607 before `*b* _c_` after | 615 before `*b* _c_` after |
| 608 ''', ''' | 616 ''', ''' |
| 609 <p>before <code>*b* _c_</code> after</p> | 617 <p>before <code>*b* _c_</code> after</p> |
| 610 '''); | 618 '''); |
| 611 | 619 |
| 612 validate('escape HTML characters', ''' | 620 validate('escape HTML characters', ''' |
| 613 `<&>` | 621 `<&>` |
| 614 ''', ''' | 622 ''', ''' |
| 615 <p><code><&></code></p> | 623 <p><code><&></code></p> |
| 616 '''); | 624 '''); |
| 625 |
| 626 validate('escape HTML tags', ''' |
| 627 '*' `<em>` |
| 628 ''', ''' |
| 629 <p>'*' <code><em></code></p> |
| 630 '''); |
| 617 }); | 631 }); |
| 618 | 632 |
| 619 group('HTML encoding', () { | 633 group('HTML encoding', () { |
| 620 validate('less than and ampersand are escaped', ''' | 634 validate('less than and ampersand are escaped', ''' |
| 621 < & | 635 < & |
| 622 ''', ''' | 636 ''', ''' |
| 623 <p>< &</p> | 637 <p>< &</p> |
| 624 '''); | 638 '''); |
| 625 validate('greater than is not escaped', ''' | 639 validate('greater than is not escaped', ''' |
| 626 not you > | 640 not you > |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 ''', ''' | 695 ''', ''' |
| 682 <p>[not] [known]</p> | 696 <p>[not] [known]</p> |
| 683 '''); | 697 '''); |
| 684 validate('can style link contents', ''' | 698 validate('can style link contents', ''' |
| 685 links [*are*] [a] awesome | 699 links [*are*] [a] awesome |
| 686 | 700 |
| 687 [a]: http://foo.com | 701 [a]: http://foo.com |
| 688 ''', ''' | 702 ''', ''' |
| 689 <p>links <a href="http://foo.com"><em>are</em></a> awesome</p> | 703 <p>links <a href="http://foo.com"><em>are</em></a> awesome</p> |
| 690 '''); | 704 '''); |
| 705 validate('inline styles after a bad link are processed', ''' |
| 706 [bad] `code` |
| 707 ''', ''' |
| 708 <p>[bad] <code>code</code></p> |
| 709 '''); |
| 691 }); | 710 }); |
| 692 | 711 |
| 693 group('Inline links', () { | 712 group('Inline links', () { |
| 694 validate('double quotes for title', ''' | 713 validate('double quotes for title', ''' |
| 695 links [are](http://foo.com "woo") awesome | 714 links [are](http://foo.com "woo") awesome |
| 696 ''', ''' | 715 ''', ''' |
| 697 <p>links <a href="http://foo.com" title="woo">are</a> awesome</p> | 716 <p>links <a href="http://foo.com" title="woo">are</a> awesome</p> |
| 698 '''); | 717 '''); |
| 699 validate('no title', ''' | 718 validate('no title', ''' |
| 700 links [are] (http://foo.com) awesome | 719 links [are] (http://foo.com) awesome |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 | 797 |
| 779 // If one string runs out of non-ignored strings, the other must too. | 798 // If one string runs out of non-ignored strings, the other must too. |
| 780 if (i == a.length) return j == b.length; | 799 if (i == a.length) return j == b.length; |
| 781 if (j == b.length) return i == a.length; | 800 if (j == b.length) return i == a.length; |
| 782 | 801 |
| 783 if (a[i] != b[j]) return false; | 802 if (a[i] != b[j]) return false; |
| 784 i++; | 803 i++; |
| 785 j++; | 804 j++; |
| 786 } | 805 } |
| 787 } | 806 } |
| OLD | NEW |