| Index: pkg/dartdoc/test/markdown_test.dart
|
| diff --git a/tests/utils/markdown_test.dart b/pkg/dartdoc/test/markdown_test.dart
|
| similarity index 95%
|
| rename from tests/utils/markdown_test.dart
|
| rename to pkg/dartdoc/test/markdown_test.dart
|
| index c4600313ef6dde56e329a4fd11036aebea0265ce..0dbef795839cd899d26a9e453ed706a11ab32eae 100644
|
| --- a/tests/utils/markdown_test.dart
|
| +++ b/pkg/dartdoc/test/markdown_test.dart
|
| @@ -5,12 +5,11 @@
|
| /// Unit tests for markdown.
|
| #library('markdown_tests');
|
|
|
| -// TODO(rnystrom): Move this test into pkg/dartdoc/test.
|
| -#import('../../pkg/dartdoc/lib/markdown.dart');
|
| +// TODO(rnystrom): Use "package:" URL (#4968).
|
| +#import('../lib/markdown.dart');
|
|
|
| // TODO(rnystrom): Better path to unittest.
|
| -#import('../../pkg/unittest/unittest.dart');
|
| -#import('test_utils.dart');
|
| +#import('../../unittest/unittest.dart');
|
|
|
| /// Most of these tests are based on observing how showdown behaves:
|
| /// http://softwaremaniacs.org/playground/showdown-highlight/
|
| @@ -744,6 +743,34 @@ void main() {
|
| });
|
| }
|
|
|
| +/**
|
| + * Removes eight spaces of leading indentation from a multiline string.
|
| + *
|
| + * Note that this is very sensitive to how the literals are styled. They should
|
| + * be:
|
| + * '''
|
| + * Text starts on own line. Lines up with subsequent lines.
|
| + * Lines are indented exactly 8 characters from the left margin.'''
|
| + *
|
| + * This does nothing if text is only a single line.
|
| + */
|
| +// TODO(nweiz): Make this auto-detect the indentation level from the first
|
| +// non-whitespace line.
|
| +String cleanUpLiteral(String text) {
|
| + var lines = text.split('\n');
|
| + if (lines.length <= 1) return text;
|
| +
|
| + for (var j = 0; j < lines.length; j++) {
|
| + if (lines[j].length > 8) {
|
| + lines[j] = lines[j].substring(8, lines[j].length);
|
| + } else {
|
| + lines[j] = '';
|
| + }
|
| + }
|
| +
|
| + return Strings.join(lines, '\n');
|
| +}
|
| +
|
| validate(String description, String markdown, String html) {
|
| test(description, () {
|
| markdown = cleanUpLiteral(markdown);
|
|
|