test: add a test verifying that the tests are run in the checked mode

This commit is contained in:
vsavkin 2015-12-01 15:41:46 -08:00 committed by Jeremy Elbourn
parent 093b7948be
commit 442d6866da
1 changed files with 14 additions and 1 deletions

View File

@ -11,10 +11,23 @@ import {
xit xit
} from 'angular2/testing_internal'; } from 'angular2/testing_internal';
import {assertionsEnabled} from 'angular2/src/facade/lang'; import {assertionsEnabled, IS_DART} from 'angular2/src/facade/lang';
export function main() { export function main() {
describe('dev mode', () => { describe('dev mode', () => {
it('is enabled in our tests by default', () => { expect(assertionsEnabled()).toBe(true); }); it('is enabled in our tests by default', () => { expect(assertionsEnabled()).toBe(true); });
}); });
if (IS_DART) {
describe('checked mode', () => {
it('is enabled in our tests', () => {
try {
var s: string = <any>42;
expect(s).toEqual(42); // without it, dart analyzer will complain that `s` is not used.
throw "should not be reached";
} catch (e) {
}
});
});
}
} }