platform-common-utilities/packages/combinator/test/match_test.dart

17 lines
464 B
Dart
Raw Normal View History

2021-09-11 14:05:50 +00:00
import 'package:belatuk_combinator/belatuk_combinator.dart';
2021-09-11 13:46:31 +00:00
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);
});
}