Skip to content

Commit 838e44f

Browse files
authored
Release 0.4.0 (#4)
1 parent fc4e175 commit 838e44f

11 files changed

+891
-12
lines changed

.github/workflows/run_tests.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Flutter analyze and tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
tags-ignore:
8+
- 'v*'
9+
10+
jobs:
11+
on-pull-request:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: subosito/flutter-action@v1
16+
with:
17+
channel: 'stable'
18+
19+
- name: Download pub dependencies
20+
run: flutter pub get
21+
22+
- name: Check formatting
23+
run: flutter format --set-exit-if-changed --dry-run .
24+
25+
- name: Run analyzer
26+
run: flutter analyze
27+
28+
- name: Run tests
29+
run: flutter test

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.4.0
4+
5+
* Added assertions for strings.
6+
* Downgraded test package to 1.16.5.
7+
38
## 0.3.0
49

510
Null safety migration.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2020 Karol Lisiewicz
1+
Copyright 2021 Karol Lisiewicz
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

README.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,77 @@ hasChildren.shouldNotBeTrue();
101101
1.shouldBeInRange(lowerBound: 1, upperBound: 6);
102102
```
103103

104-
#### CharSequence Assertions
104+
#### String Assertions
105+
106+
```dart
107+
'Flutter'.shouldBeEqualToIgnoringCase('FLUTTER');
108+
'Flutter'.shouldNotBeEqualToIgnoringCase('Xamarin');
109+
```
110+
111+
```dart
112+
'Flutter rules'.shouldStartWith('Flutter');
113+
'Flutter rules'.shouldNotStartWith('Xamarin');
114+
```
115+
116+
```dart
117+
'Flutter rules'.shouldStartWithIgnoringCase('FLUTTER');
118+
'Flutter rules'.shouldNotStartWithIgnoringCase('Xamarin');
119+
```
120+
121+
```dart
122+
'I love Flutter'.shouldEndWith('Flutter');
123+
'I love Flutter'.shouldNotEndWith('Xamarin');
124+
```
125+
126+
```dart
127+
'I love Flutter'.shouldEndWithIgnoringCase('flutter');
128+
'I love Flutter'.shouldNotEndWithIgnoringCase('xamarin');
129+
```
130+
131+
```dart
132+
'I love Flutter'.shouldContain('love');
133+
'I love Flutter'.shouldNotContain('hate');
134+
```
135+
136+
```dart
137+
'I love Flutter'.shouldContainIgnoringCase('LOVE');
138+
'I love Flutter'.shouldNotContainIgnoringCase('HATE');
139+
```
140+
141+
```dart
142+
'I love Flutter'.shouldContainAll(['Flutter', 'love']);
143+
'I love Flutter'.shouldContainAllIgnoringCase(['flutter', 'love']);
144+
```
145+
146+
```dart
147+
'I love Flutter'.shouldContainAllInOrder(['love', 'Flutter']);
148+
'I love Flutter'.shouldContainAllInOrderIgnoringCase(['Love', 'Flutter']);
149+
```
150+
151+
```dart
152+
'12345'.shouldMatch(r'\d');
153+
'Hello'.shouldNotMatch(r'\d');
154+
```
155+
156+
```dart
157+
''.shouldBeEmpty()
158+
'name'.shouldNotBeEmpty()
159+
```
160+
161+
```dart
162+
''.shouldBeNullOrEmpty()
163+
'name'.shouldNotBeNullOrEmpty()
164+
```
165+
166+
```dart
167+
' '.shouldBeBlank()
168+
'name'.shouldNotBeBlank()
169+
```
170+
171+
```dart
172+
' '.shouldBeNullOrBlank()
173+
'name'.shouldNotBeNullOrBlank()
174+
```
105175

106176
#### Collection Assertions
107177

example/fluent_assertions_example.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ void main() {
4040
test('a person age should be positive', () {
4141
teenager.age.shouldBePositive();
4242
});
43+
44+
test('a person name should not be null or blank', () {
45+
adult.name.shouldNotBeNullOrBlank();
46+
});
47+
48+
test('a person name should contain only letters', () {
49+
adult.name.shouldMatch(RegExp('[a-zA-Z]'));
50+
});
4351
}
4452

4553
class Person {

lib/fluent_assertions.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
/// Support for doing something awesome.
1+
/// The Fluent Assertions library written in Dart.
22
///
3-
/// More dartdocs go here.
3+
/// It uses Dart's Extension Functions to provide a fluent wrapper around test assertions.
44
library fluent_assertions;
55

66
export 'src/basic_assertions.dart';
77
export 'src/numerical_assertions.dart';
8+
export 'src/string_assertions.dart';

0 commit comments

Comments
 (0)