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

15 lines
385 B
Dart

import 'package:angel3_combinator/angel3_combinator.dart';
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);
});
}