Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1972)

Unified Diff: third_party/pkg/di/test/fixed-unittest.dart

Issue 1086713003: Remove everything but markdown from third_party (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pkg/di/test/assets/gen_test1/main.dart ('k') | third_party/pkg/di/test/generator_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/di/test/fixed-unittest.dart
diff --git a/third_party/pkg/di/test/fixed-unittest.dart b/third_party/pkg/di/test/fixed-unittest.dart
deleted file mode 100644
index 5639d27bbbf66498af721895368c246dccf7cd08..0000000000000000000000000000000000000000
--- a/third_party/pkg/di/test/fixed-unittest.dart
+++ /dev/null
@@ -1,110 +0,0 @@
-library unittest;
-
-import 'package:unittest/unittest.dart';
-import 'package:di/mirrors.dart';
-import 'dart:async';
-
-export 'package:unittest/unittest.dart';
-
-// Jasmine-like syntax for unittest.
-void describe(String spec, TestFunction body) => group(spec, body);
-void ddescribe(String spec, TestFunction body) => solo_group(spec, body);
-void xdescribe(String spec, TestFunction body) {}
-void it(String spec, TestFunction body) => test(spec, body);
-void xit(String spec, TestFunction body) {}
-void iit(String spec, TestFunction body) => solo_test(spec, body);
-
-Matcher toEqual(expected) => equals(expected);
-Matcher toContain(expected) => contains(expected);
-Matcher toBe(expected) => same(expected);
-Matcher instanceOf(Type t) => new IsInstanceOfTypeMatcher(t);
-
-Matcher toThrow(Type exceptionClass, [message]) => message == null
- ? new ThrowsMatcher(instanceOf(exceptionClass))
- : new ThrowsMatcher(new ComplexExceptionMatcher(
- instanceOf(exceptionClass),
- message is Matcher ? message : toContain(message)));
-
-Matcher not(Matcher matcher) => new NegateMatcher(matcher);
-
-
-class NegateMatcher extends Matcher {
- final Matcher _matcher;
-
- const NegateMatcher(this._matcher);
-
- bool matches(obj, Map ms) => !_matcher.matches(obj, ms);
-
- Description describe(Description description) =>
- _matcher.describe(description.add('NOT'));
-
- Description describeMismatch(item, Description mismatchDescription,
- Map matchState, bool verbose) {
- return _matcher.describeMismatch(
- item, mismatchDescription, matchState, verbose);
- }
-}
-
-
-class ThrowsMatcher extends Throws {
- final Matcher _matcher;
-
- const ThrowsMatcher([Matcher matcher]) : _matcher = matcher, super(matcher);
-
- Description describeMismatch(item, Description mismatchDescription,
- Map matchState,
- bool verbose) {
- if (item is! Function && item is! Future) {
- return mismatchDescription.add(' not a Function or Future');
- }
-
- if (_matcher == null || matchState == null) {
- return mismatchDescription.add(' did not throw any exception');
- }
-
- return _matcher.describeMismatch(item, mismatchDescription,
- matchState, verbose);
- }
-}
-
-class ComplexExceptionMatcher extends Matcher {
- Matcher classMatcher;
- Matcher messageMatcher;
-
- ComplexExceptionMatcher(this.classMatcher, this.messageMatcher);
-
- bool matches(obj, Map ms) {
- if (!classMatcher.matches(obj, ms)) {
- return false;
- }
-
- return messageMatcher.matches(obj.message, ms);
- }
-
- Description describe(Description description) =>
- messageMatcher.describe(classMatcher.describe(description).add(' with message '));
-
- Description describeMismatch(item, Description mismatchDescription,
- Map matchState, bool verbose) {
- var e = matchState['exception'];
-
- mismatchDescription.add('threw ').addDescriptionOf(e);
-
- try {
- var message = e.message; // does not have to be defined
- mismatchDescription.add(' with message ').addDescriptionOf(message);
- } catch (e) {}
- }
-}
-
-class IsInstanceOfTypeMatcher extends Matcher {
- Type t;
-
- IsInstanceOfTypeMatcher(this.t);
-
- bool matches(obj, Map matchState) =>
- reflect(obj).type.qualifiedName == reflectClass(t).qualifiedName;
-
- Description describe(Description description) =>
- description.add('an instance of ${t.toString()}');
-}
« no previous file with comments | « third_party/pkg/di/test/assets/gen_test1/main.dart ('k') | third_party/pkg/di/test/generator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698