| 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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 cleanUpLiteral(String text) { | 771 cleanUpLiteral(String text) { |
| 772 var lines = text.split('\n'); | 772 var lines = text.split('\n'); |
| 773 for (var j = 0; j < lines.length; j++) { | 773 for (var j = 0; j < lines.length; j++) { |
| 774 if (lines[j].length > 8) { | 774 if (lines[j].length > 8) { |
| 775 lines[j] = lines[j].substring(8, lines[j].length); | 775 lines[j] = lines[j].substring(8, lines[j].length); |
| 776 } else { | 776 } else { |
| 777 lines[j] = ''; | 777 lines[j] = ''; |
| 778 } | 778 } |
| 779 } | 779 } |
| 780 | 780 |
| 781 return Strings.join(lines, '\n'); | 781 return lines.join('\n'); |
| 782 } | 782 } |
| 783 | 783 |
| 784 /// Does a loose comparison of the two strings of HTML. Ignores differences in | 784 /// Does a loose comparison of the two strings of HTML. Ignores differences in |
| 785 /// newlines and indentation. | 785 /// newlines and indentation. |
| 786 compareOutput(String a, String b) { | 786 compareOutput(String a, String b) { |
| 787 int i = 0; | 787 int i = 0; |
| 788 int j = 0; | 788 int j = 0; |
| 789 | 789 |
| 790 skipIgnored(String s, int i) { | 790 skipIgnored(String s, int i) { |
| 791 // Ignore newlines. | 791 // Ignore newlines. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 804 | 804 |
| 805 // If one string runs out of non-ignored strings, the other must too. | 805 // If one string runs out of non-ignored strings, the other must too. |
| 806 if (i == a.length) return j == b.length; | 806 if (i == a.length) return j == b.length; |
| 807 if (j == b.length) return i == a.length; | 807 if (j == b.length) return i == a.length; |
| 808 | 808 |
| 809 if (a[i] != b[j]) return false; | 809 if (a[i] != b[j]) return false; |
| 810 i++; | 810 i++; |
| 811 j++; | 811 j++; |
| 812 } | 812 } |
| 813 } | 813 } |
| OLD | NEW |