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 cb76d6843de7ee97f4ba1df16964a777ec6c707b..35e964a5a2c9b9eaeee399562b9ce41a309abb5a 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 == double.NaN; |
|
kevmoo
2014/07/25 18:21:08
double.NAN
Are you running tests locally before u
srawlins
2014/07/30 17:08:03
Sorry, I was _not_ running the correct set of test
|
| + Description describe(Description description) => description.add('NaN'); |
| +} |
| + |
| +class _IsNotNaN extends Matcher { |
| + const _IsNotNaN(); |
| + bool matches(item, Map matchState) => item != double.NaN; |
|
kevmoo
2014/07/25 18:21:08
ditto
srawlins
2014/07/30 17:08:03
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); |