Chromium Code Reviews| Index: pkg/matcher/lib/src/core_matchers.dart |
| diff --git a/pkg/matcher/lib/src/core_matchers.dart b/pkg/matcher/lib/src/core_matchers.dart |
| index 356476b24d0f33d49d373f6ef7bb4ad7a4f3cba2..e33177cf6380f6b6bb91e88e3e52aa30203a7c27 100644 |
| --- a/pkg/matcher/lib/src/core_matchers.dart |
| +++ b/pkg/matcher/lib/src/core_matchers.dart |
| @@ -64,6 +64,24 @@ class _IsFalse extends Matcher { |
| Description describe(Description description) => description.add('false'); |
| } |
| +/// A matcher that matches the numeric value NaN. |
| +const Matcher isNaN = const _IsNull(); |
| + |
| +/// A matcher that matches any non-NaN value. |
| +const Matcher isNotNaN = const _IsNotNaN(); |
| + |
| +class _IsNaN extends Matcher { |
| + const _IsNaN(); |
| + bool matches(item, Map matchState) => item == NaN; |
|
kevmoo
2014/07/22 20:44:37
Where is NaN coming from here? Do you mean double.
srawlins
2014/07/22 22:49:06
Done.
|
| + Description describe(Description description) => description.add('NaN'); |
| +} |
| + |
| +class _IsNotNaN extends Matcher { |
| + const _IsNotNaN(); |
| + bool matches(item, Map matchState) => item != NaN; |
|
kevmoo
2014/07/22 20:44:37
ditto
srawlins
2014/07/22 22:49:06
Done.
|
| + Description describe(Description description) => description.add('not NaN'); |
| +} |
| + |
| /// Returns a matches that matches if the value is the same instance |
| /// as [expected], using [identical]. |
| Matcher same(expected) => new _IsSameAs(expected); |