| Index: recipes/test/core/strings/determining_if_string_contains_test.dart
|
| diff --git a/recipes/test/core/strings/determining_if_string_contains_test.dart b/recipes/test/core/strings/determining_if_string_contains_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..30fdb1fc887fb1ca88909de09e673f33e96151c3
|
| --- /dev/null
|
| +++ b/recipes/test/core/strings/determining_if_string_contains_test.dart
|
| @@ -0,0 +1,32 @@
|
| +library determining_if_string_contains_test;
|
| +
|
| +import 'package:unittest/unittest.dart';
|
| +
|
| +void main() {
|
| +
|
| + group('determining whether a string contains a substring', () {
|
| + var fact = 'Dart strings are immutable';
|
| +
|
| + test('using contains', () {
|
| + expect(fact.contains('immutable'), isTrue);
|
| + expect(fact.contains('Dart', 2), isFalse);
|
| + });
|
| +
|
| + test('using startsWith()', () {
|
| + expect(fact.startsWith('Dart'), isTrue);
|
| + });
|
| +
|
| + test('using endsWith()', () {
|
| + assert(fact.endsWith('e') == true);
|
| + });
|
| +
|
| + test('using indexOf()', () {
|
| + expect(fact.indexOf('art') != -1, isTrue);
|
| + });
|
| +
|
| + test('using hasMatch()', () {
|
| + expect(new RegExp(r'ar[et]').hasMatch(fact), isTrue);
|
| + });
|
| + });
|
| +
|
| +}
|
|
|