Files
sdk/pkg/analysis_server/test/tool/lsp_spec/markdown_test.dart
T
Konstantin Shcheglov 4757152a0b Migrate a few random analysis_server libraries.
Mostly no-ops.

Change-Id: Ia538aed657576203ec104bd849862bcc87025bef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194006
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-04-05 16:06:36 +00:00

53 lines
1.1 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';
void main() {
group('markdown parser', () {
test('extracts a typescript fenced block from Markdown', () {
final input = '''
```typescript
CONTENT
```
''';
final output = extractTypeScriptBlocks(input);
expect(output, hasLength(1));
expect(output, contains('CONTENT'));
});
test('does not extract unknown code blocks', () {
final input = '''
```
CONTENT
```
```dart
CONTENT
```
''';
final output = extractTypeScriptBlocks(input);
expect(output, hasLength(0));
});
test('extracts multiple code blocks', () {
final input = '''
```typescript
CONTENT1
```
```typescript
CONTENT2
```
''';
final output = extractTypeScriptBlocks(input);
expect(output, hasLength(2));
expect(output, contains('CONTENT1'));
expect(output, contains('CONTENT2'));
});
});
}