fix(transpile): fix usage of int and references to assert module
This commit is contained in:
@@ -230,13 +230,6 @@ function returnType(actual, T) {
|
||||
return actual;
|
||||
}
|
||||
|
||||
// `int` is not a valid JS type, and traceur will leave
|
||||
// it untouched. However, we want to be able to use it,
|
||||
// so we provide it as a global
|
||||
var intType = _global['int'] = define('int', function(value) {
|
||||
return typeof value === 'number' && value%1 === 0;
|
||||
});
|
||||
|
||||
// TODO(vojta): define these with DSL?
|
||||
var string = type.string = define('string', function(value) {
|
||||
return typeof value === 'string';
|
||||
@@ -362,7 +355,6 @@ assert.fail = fail;
|
||||
assert.string = string;
|
||||
assert.number = number;
|
||||
assert.boolean = boolean;
|
||||
assert.int = intType;
|
||||
|
||||
// custom types
|
||||
assert.arrayOf = arrayOf;
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
// - [assert.structure](#assert-structure)
|
||||
// - [Integrating with Traceur](#integrating-with-traceur)
|
||||
|
||||
import {assert} from 'rtts_assert/rtts_assert';
|
||||
|
||||
// Note: `assert` gets automatically included by traceur!
|
||||
|
||||
export function main() {
|
||||
|
||||
@@ -370,27 +369,6 @@ describe('Traceur', function() {
|
||||
});
|
||||
});
|
||||
|
||||
// Note: `int` is not part of JS types, but rtts_assert exposes a global
|
||||
// so that it can be used as well.
|
||||
describe('int', function() {
|
||||
|
||||
it('should pass', function() {
|
||||
var x:int = 10;
|
||||
});
|
||||
|
||||
it('should fail', function() {
|
||||
expect(() => {
|
||||
var x:int = 'ok';
|
||||
}).toThrowError('Expected an instance of int, got "ok"!');
|
||||
});
|
||||
|
||||
it('should fail', function() {
|
||||
expect(() => {
|
||||
var x:int = 12.3;
|
||||
}).toThrowError('Expected an instance of int, got 12.3!');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('generics', function() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user