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

Commit

Permalink
tests: Move util tests to a new file
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdeboer authored and vsavkin committed Sep 16, 2014
1 parent e4fdea4 commit b2f9675
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
29 changes: 0 additions & 29 deletions test/angular_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ library angular_spec;
import 'dart:mirrors';

import '_specs.dart';
import 'package:angular/utils.dart';
import 'package:angular/tools/symbol_inspector/symbol_inspector.dart';

main() {
Expand All @@ -16,34 +15,6 @@ main() {
});
});

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]);
}).toThrowWith(message: 'Unknown function type, expecting 0 to 5 args.');
});
});

describe('symbols', () {
it('should not export unknown symbols from animate', () {
LibraryInfo libraryInfo;
Expand Down
35 changes: 35 additions & 0 deletions test/utils_spec.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
library utils_spec;

import '_specs.dart';
import 'package:angular/utils.dart';

main() {
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]);
}).toThrowWith(message: 'Unknown function type, expecting 0 to 5 args.');
});
});
}

0 comments on commit b2f9675

Please sign in to comment.