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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 if (!passed) { | 754 if (!passed) { |
755 // Remove trailing newline. | 755 // Remove trailing newline. |
756 html = html.substring(0, html.length - 1); | 756 html = html.substring(0, html.length - 1); |
757 | 757 |
758 print('FAIL: $description'); | 758 print('FAIL: $description'); |
759 print(' expect: ${html.replaceAll("\n", "\n ")}'); | 759 print(' expect: ${html.replaceAll("\n", "\n ")}'); |
760 print(' actual: ${result.replaceAll("\n", "\n ")}'); | 760 print(' actual: ${result.replaceAll("\n", "\n ")}'); |
761 print(''); | 761 print(''); |
762 } | 762 } |
763 | 763 |
764 expect(passed).isTrue(); | 764 expect(passed, isTrue); |
765 }); | 765 }); |
766 } | 766 } |
767 | 767 |
768 /// Does a loose comparison of the two strings of HTML. Ignores differences in | 768 /// Does a loose comparison of the two strings of HTML. Ignores differences in |
769 /// newlines and indentation. | 769 /// newlines and indentation. |
770 compareOutput(String a, String b) { | 770 compareOutput(String a, String b) { |
771 int i = 0; | 771 int i = 0; |
772 int j = 0; | 772 int j = 0; |
773 | 773 |
774 skipIgnored(String s, int i) { | 774 skipIgnored(String s, int i) { |
(...skipping 13 matching lines...) Expand all Loading... |
788 | 788 |
789 // If one string runs out of non-ignored strings, the other must too. | 789 // If one string runs out of non-ignored strings, the other must too. |
790 if (i == a.length) return j == b.length; | 790 if (i == a.length) return j == b.length; |
791 if (j == b.length) return i == a.length; | 791 if (j == b.length) return i == a.length; |
792 | 792 |
793 if (a[i] != b[j]) return false; | 793 if (a[i] != b[j]) return false; |
794 i++; | 794 i++; |
795 j++; | 795 j++; |
796 } | 796 } |
797 } | 797 } |
OLD | NEW |