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/dartdoc/markdown.dart'); | 8 #import('../../../lib/dartdoc/markdown.dart'); |
9 | 9 |
10 // TODO(rnystrom): Better path to unittest. | 10 // TODO(rnystrom): Better path to unittest. |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 | 700 |
701 [a]: http://foo.com | 701 [a]: http://foo.com |
702 ''', ''' | 702 ''', ''' |
703 <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> |
704 '''); | 704 '''); |
705 validate('inline styles after a bad link are processed', ''' | 705 validate('inline styles after a bad link are processed', ''' |
706 [bad] `code` | 706 [bad] `code` |
707 ''', ''' | 707 ''', ''' |
708 <p>[bad] <code>code</code></p> | 708 <p>[bad] <code>code</code></p> |
709 '''); | 709 '''); |
| 710 validate('empty reference uses text from link', ''' |
| 711 links [are][] awesome |
| 712 |
| 713 [are]: http://foo.com |
| 714 ''', ''' |
| 715 <p>links <a href="http://foo.com">are</a> awesome</p> |
| 716 '''); |
| 717 validate('references are case-insensitive', ''' |
| 718 links [ARE][] awesome |
| 719 |
| 720 [are]: http://foo.com |
| 721 ''', ''' |
| 722 <p>links <a href="http://foo.com">ARE</a> awesome</p> |
| 723 '''); |
710 }); | 724 }); |
711 | 725 |
712 group('Inline links', () { | 726 group('Inline links', () { |
713 validate('double quotes for title', ''' | 727 validate('double quotes for title', ''' |
714 links [are](http://foo.com "woo") awesome | 728 links [are](http://foo.com "woo") awesome |
715 ''', ''' | 729 ''', ''' |
716 <p>links <a href="http://foo.com" title="woo">are</a> awesome</p> | 730 <p>links <a href="http://foo.com" title="woo">are</a> awesome</p> |
717 '''); | 731 '''); |
718 validate('no title', ''' | 732 validate('no title', ''' |
719 links [are] (http://foo.com) awesome | 733 links [are] (http://foo.com) awesome |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 811 |
798 // If one string runs out of non-ignored strings, the other must too. | 812 // If one string runs out of non-ignored strings, the other must too. |
799 if (i == a.length) return j == b.length; | 813 if (i == a.length) return j == b.length; |
800 if (j == b.length) return i == a.length; | 814 if (j == b.length) return i == a.length; |
801 | 815 |
802 if (a[i] != b[j]) return false; | 816 if (a[i] != b[j]) return false; |
803 i++; | 817 i++; |
804 j++; | 818 j++; |
805 } | 819 } |
806 } | 820 } |
OLD | NEW |