platform/packages/combinator/test/match_test.dart
thomashii@dukefirehawk.com 33f51d837b Publish angel3_combinator
2021-05-14 14:11:50 +08:00

16 lines
462 B
Dart

import 'package:angel3_combinator/angel3_combinator.dart';
import 'package:test/test.dart';
import 'common.dart';
void main() {
test('match string', () {
expect(match('hello').parse(scan('hello world')).successful, isTrue);
});
test('match start only', () {
expect(match('hello').parse(scan('goodbye hello')).successful, isFalse);
});
test('fail if no match', () {
expect(match('hello').parse(scan('world')).successful, isFalse);
});
}