style(dart): Format Dart source with dart_style 0.1.8

This commit is contained in:
Tim Blasi
2015-05-29 10:42:47 -07:00
parent eb2784eb81
commit ffb219fb91
17 changed files with 190 additions and 171 deletions

View File

@ -4,12 +4,18 @@ library angular2.test.facade.async_dart_spec;
import 'package:angular2/test_lib.dart';
import 'package:angular2/src/facade/async.dart';
class MockException implements Error { var message; var stackTrace; }
class NonError { var message; }
class MockException implements Error {
var message;
var stackTrace;
}
class NonError {
var message;
}
void functionThatThrows() {
try { throw new MockException(); }
catch(e, stack) {
try {
throw new MockException();
} catch (e, stack) {
// If we lose the stack trace the message will no longer match
// the first line in the stack
e.message = stack.toString().split('\n')[0];
@ -19,8 +25,9 @@ void functionThatThrows() {
}
void functionThatThrowsNonError() {
try { throw new NonError(); }
catch(e, stack) {
try {
throw new NonError();
} catch (e, stack) {
// If we lose the stack trace the message will no longer match
// the first line in the stack
e.message = stack.toString().split('\n')[0];
@ -39,62 +46,55 @@ void expectFunctionThatThrowsWithStackTrace(
main() {
describe('async facade', () {
describe('Completer', () {
it('should preserve Error stack traces',
inject([AsyncTestCompleter], (async) {
it('should preserve Error stack traces', inject([AsyncTestCompleter],
(async) {
var c = PromiseWrapper.completer();
expectFunctionThatThrowsWithStackTrace(c.promise, async);
try {
functionThatThrows();
} catch(e) {
} catch (e) {
c.reject(e, null);
}
}));
it('should preserve error stack traces for non-Errors',
inject([AsyncTestCompleter], (async) {
it('should preserve error stack traces for non-Errors', inject(
[AsyncTestCompleter], (async) {
var c = PromiseWrapper.completer();
expectFunctionThatThrowsWithStackTrace(c.promise, async);
try {
functionThatThrowsNonError();
} catch(e, s) {
} catch (e, s) {
c.reject(e, s);
}
}));
});
describe('PromiseWrapper', () {
describe('reject', () {
it('should preserve Error stack traces',
inject([AsyncTestCompleter], (async) {
it('should preserve Error stack traces', inject([AsyncTestCompleter],
(async) {
try {
functionThatThrows();
} catch(e) {
} catch (e) {
var rejectedFuture = PromiseWrapper.reject(e, null);
expectFunctionThatThrowsWithStackTrace(rejectedFuture, async);
}
}));
it('should preserve stack traces for non-Errors',
inject([AsyncTestCompleter], (async) {
it('should preserve stack traces for non-Errors', inject(
[AsyncTestCompleter], (async) {
try {
functionThatThrowsNonError();
} catch(e, s) {
} catch (e, s) {
var rejectedFuture = PromiseWrapper.reject(e, s);
expectFunctionThatThrowsWithStackTrace(rejectedFuture, async);
}
}));
});
});
});
}