Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 4dee442

Browse files
committed
tests: Move util tests to a new file
1 parent 94c3522 commit 4dee442

File tree

2 files changed

+35
-29
lines changed

2 files changed

+35
-29
lines changed

test/angular_spec.dart

-29
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ library angular_spec;
33
import 'dart:mirrors';
44

55
import '_specs.dart';
6-
import 'package:angular/utils.dart';
76
import 'package:angular/tools/symbol_inspector/symbol_inspector.dart';
87

98
main() {
@@ -16,34 +15,6 @@ main() {
1615
});
1716
});
1817

19-
describe('relaxFnApply', () {
20-
it('should work with 6 arguments', () {
21-
var sixArgs = [1, 1, 2, 3, 5, 8];
22-
expect(relaxFnApply(() => "none", sixArgs)).toEqual("none");
23-
expect(relaxFnApply((a) => a, sixArgs)).toEqual(1);
24-
expect(relaxFnApply((a, b) => a + b, sixArgs)).toEqual(2);
25-
expect(relaxFnApply((a, b, c) => a + b + c, sixArgs)).toEqual(4);
26-
expect(relaxFnApply((a, b, c, d) => a + b + c + d, sixArgs)).toEqual(7);
27-
expect(relaxFnApply((a, b, c, d, e) => a + b + c + d + e, sixArgs)).toEqual(12);
28-
});
29-
30-
it('should work with 0 arguments', () {
31-
var noArgs = [];
32-
expect(relaxFnApply(() => "none", noArgs)).toEqual("none");
33-
expect(relaxFnApply(([a]) => a, noArgs)).toEqual(null);
34-
expect(relaxFnApply(([a, b]) => b, noArgs)).toEqual(null);
35-
expect(relaxFnApply(([a, b, c]) => c, noArgs)).toEqual(null);
36-
expect(relaxFnApply(([a, b, c, d]) => d, noArgs)).toEqual(null);
37-
expect(relaxFnApply(([a, b, c, d, e]) => e, noArgs)).toEqual(null);
38-
});
39-
40-
it('should fail with not enough arguments', () {
41-
expect(() {
42-
relaxFnApply((required, alsoRequired) => "happy", [1]);
43-
}).toThrowWith(message: 'Unknown function type, expecting 0 to 5 args.');
44-
});
45-
});
46-
4718
describe('symbols', () {
4819
it('should not export unknown symbols from animate', () {
4920
LibraryInfo libraryInfo;

test/utils_spec.dart

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
library utils_spec;
2+
3+
import '_specs.dart';
4+
import 'package:angular/utils.dart';
5+
6+
main() {
7+
describe('relaxFnApply', () {
8+
it('should work with 6 arguments', () {
9+
var sixArgs = [1, 1, 2, 3, 5, 8];
10+
expect(relaxFnApply(() => "none", sixArgs)).toEqual("none");
11+
expect(relaxFnApply((a) => a, sixArgs)).toEqual(1);
12+
expect(relaxFnApply((a, b) => a + b, sixArgs)).toEqual(2);
13+
expect(relaxFnApply((a, b, c) => a + b + c, sixArgs)).toEqual(4);
14+
expect(relaxFnApply((a, b, c, d) => a + b + c + d, sixArgs)).toEqual(7);
15+
expect(relaxFnApply((a, b, c, d, e) => a + b + c + d + e, sixArgs)).toEqual(12);
16+
});
17+
18+
it('should work with 0 arguments', () {
19+
var noArgs = [];
20+
expect(relaxFnApply(() => "none", noArgs)).toEqual("none");
21+
expect(relaxFnApply(([a]) => a, noArgs)).toEqual(null);
22+
expect(relaxFnApply(([a, b]) => b, noArgs)).toEqual(null);
23+
expect(relaxFnApply(([a, b, c]) => c, noArgs)).toEqual(null);
24+
expect(relaxFnApply(([a, b, c, d]) => d, noArgs)).toEqual(null);
25+
expect(relaxFnApply(([a, b, c, d, e]) => e, noArgs)).toEqual(null);
26+
});
27+
28+
it('should fail with not enough arguments', () {
29+
expect(() {
30+
relaxFnApply((required, alsoRequired) => "happy", [1]);
31+
}).toThrowWith(message: 'Unknown function type, expecting 0 to 5 args.');
32+
});
33+
});
34+
}
35+

0 commit comments

Comments
 (0)