2021-03-17 23:04:36 +00:00
|
|
|
import 'package:combinator/combinator.dart';
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
import 'common.dart';
|
|
|
|
|
|
|
|
main() {
|
|
|
|
test('match string', () {
|
2021-03-18 00:00:56 +00:00
|
|
|
expect(match('hello').parse(scan('hello world'))!.successful, isTrue);
|
2021-03-17 23:04:36 +00:00
|
|
|
});
|
|
|
|
test('match start only', () {
|
2021-03-18 00:00:56 +00:00
|
|
|
expect(match('hello').parse(scan('goodbye hello'))!.successful, isFalse);
|
2021-03-17 23:04:36 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test('fail if no match', () {
|
2021-03-18 00:00:56 +00:00
|
|
|
expect(match('hello').parse(scan('world'))!.successful, isFalse);
|
2021-03-17 23:04:36 +00:00
|
|
|
});
|
|
|
|
}
|