2016-06-23 12:47:54 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-10-06 18:10:27 -04:00
|
|
|
import {NumberWrapper, escapeRegExp, hasConstructor} from '../src/lang';
|
2016-03-08 19:38:50 -05:00
|
|
|
|
2016-02-09 20:46:38 -05:00
|
|
|
class MySuperclass {}
|
|
|
|
class MySubclass extends MySuperclass {}
|
|
|
|
|
2015-05-26 20:00:31 -04:00
|
|
|
export function main() {
|
2015-06-02 11:07:13 -04:00
|
|
|
describe('RegExp', () => {
|
2016-06-20 17:21:01 -04:00
|
|
|
it('should escape regexp', () => {
|
2016-08-05 12:50:49 -04:00
|
|
|
expect(new RegExp(escapeRegExp('b')).exec('abc')).toBeTruthy();
|
|
|
|
expect(new RegExp(escapeRegExp('b')).exec('adc')).toBeFalsy();
|
|
|
|
expect(new RegExp(escapeRegExp('a.b')).exec('a.b')).toBeTruthy();
|
|
|
|
expect(new RegExp(escapeRegExp('a.b')).exec('axb')).toBeFalsy();
|
2016-06-20 17:21:01 -04:00
|
|
|
});
|
|
|
|
|
2015-06-02 11:07:13 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('const', () => {
|
|
|
|
it('should support const expressions both in TS and Dart', () => {
|
2016-07-30 22:18:14 -04:00
|
|
|
const numbers = [1, 2, 3];
|
2015-06-02 11:07:13 -04:00
|
|
|
expect(numbers).toEqual([1, 2, 3]);
|
|
|
|
});
|
|
|
|
});
|
2015-05-26 20:00:31 -04:00
|
|
|
|
2016-06-09 17:32:36 -04:00
|
|
|
describe('Number', () => {
|
|
|
|
describe('isNumeric', () => {
|
|
|
|
it('should return true when passing correct numeric string',
|
|
|
|
() => { expect(NumberWrapper.isNumeric('2')).toBe(true); });
|
|
|
|
|
|
|
|
it('should return true when passing correct double string',
|
|
|
|
() => { expect(NumberWrapper.isNumeric('1.123')).toBe(true); });
|
|
|
|
|
|
|
|
it('should return true when passing correct negative string',
|
|
|
|
() => { expect(NumberWrapper.isNumeric('-2')).toBe(true); });
|
|
|
|
|
|
|
|
it('should return true when passing correct scientific notation string',
|
|
|
|
() => { expect(NumberWrapper.isNumeric('1e5')).toBe(true); });
|
|
|
|
|
|
|
|
it('should return false when passing incorrect numeric',
|
|
|
|
() => { expect(NumberWrapper.isNumeric('a')).toBe(false); });
|
|
|
|
|
|
|
|
it('should return false when passing parseable but non numeric',
|
|
|
|
() => { expect(NumberWrapper.isNumeric('2a')).toBe(false); });
|
|
|
|
});
|
|
|
|
});
|
2015-05-26 20:00:31 -04:00
|
|
|
}
|