OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library markdown.test.utils; | 5 library markdown.test.utils; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 | 8 |
9 import 'package:markdown/markdown.dart'; | 9 import 'package:markdown/markdown.dart'; |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 } else { | 29 } else { |
30 lines[j] = ''; | 30 lines[j] = ''; |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 return lines.join('\n'); | 34 return lines.join('\n'); |
35 } | 35 } |
36 | 36 |
37 void validate(String description, String markdown, String html, | 37 void validate(String description, String markdown, String html, |
38 {List<InlineSyntax> inlineSyntaxes, | 38 {List<InlineSyntax> inlineSyntaxes, |
39 Resolver linkResolver, Resolver imageLinkResolver, | 39 Resolver linkResolver, |
| 40 Resolver imageLinkResolver, |
40 bool inlineOnly: false}) { | 41 bool inlineOnly: false}) { |
41 test(description, () { | 42 test(description, () { |
42 markdown = cleanUpLiteral(markdown); | 43 markdown = cleanUpLiteral(markdown); |
43 html = cleanUpLiteral(html); | 44 html = cleanUpLiteral(html); |
44 | 45 |
45 var result = markdownToHtml(markdown, | 46 var result = markdownToHtml(markdown, |
46 inlineSyntaxes: inlineSyntaxes, | 47 inlineSyntaxes: inlineSyntaxes, |
47 linkResolver: linkResolver, | 48 linkResolver: linkResolver, |
48 imageLinkResolver: imageLinkResolver, | 49 imageLinkResolver: imageLinkResolver, |
49 inlineOnly: inlineOnly); | 50 inlineOnly: inlineOnly); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 86 |
86 // If one string runs out of non-ignored strings, the other must too. | 87 // If one string runs out of non-ignored strings, the other must too. |
87 if (i == a.length) return j == b.length; | 88 if (i == a.length) return j == b.length; |
88 if (j == b.length) return i == a.length; | 89 if (j == b.length) return i == a.length; |
89 | 90 |
90 if (a[i] != b[j]) return false; | 91 if (a[i] != b[j]) return false; |
91 i++; | 92 i++; |
92 j++; | 93 j++; |
93 } | 94 } |
94 } | 95 } |
OLD | NEW |