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

16 lines
387 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() {
var parser = match('hello').value((r) => 'world');
test('sets value', () {
expect(parser.parse(scan('hello world')).value, 'world');
});
test('no value if no match', () {
expect(parser.parse(scan('goodbye world')).value, isNull);
});
}