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

Unified Diff: third_party/pkg/angular/test/angular_spec.dart

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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
Index: third_party/pkg/angular/test/angular_spec.dart
diff --git a/third_party/pkg/angular/test/angular_spec.dart b/third_party/pkg/angular/test/angular_spec.dart
new file mode 100644
index 0000000000000000000000000000000000000000..69b427b7297c55f014dc7d500a2311df2cbbf9cf
--- /dev/null
+++ b/third_party/pkg/angular/test/angular_spec.dart
@@ -0,0 +1,43 @@
+library angular_spec;
+
+import '_specs.dart';
+import 'package:angular/utils.dart';
+
+main() {
+ describe('angular.dart unittests', () {
+ it('should run in checked moded only', () {
+ expect(() {
+ dynamic v = 6;
+ String s = v;
+ }).toThrow();
+ });
+ });
+
+ describe('relaxFnApply', () {
+ it('should work with 6 arguments', () {
+ var sixArgs = [1, 1, 2, 3, 5, 8];
+ expect(relaxFnApply(() => "none", sixArgs)).toEqual("none");
+ expect(relaxFnApply((a) => a, sixArgs)).toEqual(1);
+ expect(relaxFnApply((a, b) => a + b, sixArgs)).toEqual(2);
+ expect(relaxFnApply((a, b, c) => a + b + c, sixArgs)).toEqual(4);
+ expect(relaxFnApply((a, b, c, d) => a + b + c + d, sixArgs)).toEqual(7);
+ expect(relaxFnApply((a, b, c, d, e) => a + b + c + d + e, sixArgs)).toEqual(12);
+ });
+
+ it('should work with 0 arguments', () {
+ var noArgs = [];
+ expect(relaxFnApply(() => "none", noArgs)).toEqual("none");
+ expect(relaxFnApply(([a]) => a, noArgs)).toEqual(null);
+ expect(relaxFnApply(([a, b]) => b, noArgs)).toEqual(null);
+ expect(relaxFnApply(([a, b, c]) => c, noArgs)).toEqual(null);
+ expect(relaxFnApply(([a, b, c, d]) => d, noArgs)).toEqual(null);
+ expect(relaxFnApply(([a, b, c, d, e]) => e, noArgs)).toEqual(null);
+ });
+
+ it('should fail with not enough arguments', () {
+ expect(() {
+ relaxFnApply((required, alsoRequired) => "happy", [1]);
+ }).toThrow('Unknown function type, expecting 0 to 5 args.');
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698