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 markdownTests; | 6 library markdownTests; |
7 | 7 |
8 // TODO(rnystrom): Use "package:" URL (#4968). | 8 // TODO(rnystrom): Use "package:" URL (#4968). |
9 import '../lib/markdown.dart'; | 9 import '../lib/markdown.dart'; |
10 | 10 |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 if (lines.length <= 1) return text; | 818 if (lines.length <= 1) return text; |
819 | 819 |
820 for (var j = 0; j < lines.length; j++) { | 820 for (var j = 0; j < lines.length; j++) { |
821 if (lines[j].length > 8) { | 821 if (lines[j].length > 8) { |
822 lines[j] = lines[j].substring(8, lines[j].length); | 822 lines[j] = lines[j].substring(8, lines[j].length); |
823 } else { | 823 } else { |
824 lines[j] = ''; | 824 lines[j] = ''; |
825 } | 825 } |
826 } | 826 } |
827 | 827 |
828 return Strings.join(lines, '\n'); | 828 return lines.join('\n'); |
829 } | 829 } |
830 | 830 |
831 validate(String description, String markdown, String html, | 831 validate(String description, String markdown, String html, |
832 {bool verbose: false}) { | 832 {bool verbose: false}) { |
833 test(description, () { | 833 test(description, () { |
834 markdown = cleanUpLiteral(markdown); | 834 markdown = cleanUpLiteral(markdown); |
835 html = cleanUpLiteral(html); | 835 html = cleanUpLiteral(html); |
836 | 836 |
837 var result = markdownToHtml(markdown); | 837 var result = markdownToHtml(markdown); |
838 var passed = compareOutput(html, result); | 838 var passed = compareOutput(html, result); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 | 874 |
875 // If one string runs out of non-ignored strings, the other must too. | 875 // If one string runs out of non-ignored strings, the other must too. |
876 if (i == a.length) return j == b.length; | 876 if (i == a.length) return j == b.length; |
877 if (j == b.length) return i == a.length; | 877 if (j == b.length) return i == a.length; |
878 | 878 |
879 if (a[i] != b[j]) return false; | 879 if (a[i] != b[j]) return false; |
880 i++; | 880 i++; |
881 j++; | 881 j++; |
882 } | 882 } |
883 } | 883 } |
OLD | NEW |