| 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.');
|
| + });
|
| + });
|
| +}
|
|
|