e4842a293b
Change-Id: I401ad4537e7a8c3ea4bc3f693cf45b5f7ef31267 Reviewed-on: https://dart-review.googlesource.com/c/79340 Commit-Queue: Danny Tuppeny <dantup@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
53 lines
1.2 KiB
Dart
53 lines
1.2 KiB
Dart
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
import '../../../tool/lsp_spec/markdown.dart';
|
|
|
|
main() {
|
|
group('markdown parser', () {
|
|
test('extracts a typescript fenced block from Markdown', () {
|
|
final String input = '''
|
|
```typescript
|
|
CONTENT
|
|
```
|
|
''';
|
|
final List<String> output = extractTypeScriptBlocks(input);
|
|
expect(output, hasLength(1));
|
|
expect(output, contains('CONTENT'));
|
|
});
|
|
|
|
test('does not extract unknown code blocks', () {
|
|
final String input = '''
|
|
```
|
|
CONTENT
|
|
```
|
|
|
|
```dart
|
|
CONTENT
|
|
```
|
|
''';
|
|
final List<String> output = extractTypeScriptBlocks(input);
|
|
expect(output, hasLength(0));
|
|
});
|
|
|
|
test('extracts multiple code blocks', () {
|
|
final String input = '''
|
|
```typescript
|
|
CONTENT1
|
|
```
|
|
|
|
```typescript
|
|
CONTENT2
|
|
```
|
|
''';
|
|
final List<String> output = extractTypeScriptBlocks(input);
|
|
expect(output, hasLength(2));
|
|
expect(output, contains('CONTENT1'));
|
|
expect(output, contains('CONTENT2'));
|
|
});
|
|
});
|
|
}
|