From 4dee44277f8225d5cbf87fcaf5b9c311876d842b Mon Sep 17 00:00:00 2001 From: James deBoer Date: Mon, 15 Sep 2014 19:51:00 -0700 Subject: [PATCH] tests: Move util tests to a new file --- test/angular_spec.dart | 29 ----------------------------- test/utils_spec.dart | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 29 deletions(-) create mode 100644 test/utils_spec.dart diff --git a/test/angular_spec.dart b/test/angular_spec.dart index 5b6d4e5de..bd84d6dec 100644 --- a/test/angular_spec.dart +++ b/test/angular_spec.dart @@ -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() { @@ -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; diff --git a/test/utils_spec.dart b/test/utils_spec.dart new file mode 100644 index 000000000..5d09edde3 --- /dev/null +++ b/test/utils_spec.dart @@ -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.'); + }); + }); +} +