fix: convert tests to plain js

This commit is contained in:
Jannik Keye 2018-07-06 09:41:08 +02:00
parent 99d66ad6ed
commit 2022b44416

View File

@ -21,7 +21,7 @@ fn apply() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -53,22 +53,19 @@ fn construct() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
export function test() { export function test() {
class Rectangle { class Rectangle {
public x: number; constructor(x, y){
public y: number;
constructor(x: number, y: number){
this.x = x, this.x = x,
this.y = y this.y = y
} }
static eq(x: number, y: number) { static eq(x, y) {
return x === y; return x === y;
} }
@ -102,37 +99,31 @@ fn construct_with_new_target() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
export function test() { export function test() {
class Rectangle { class Rectangle {
public x: number; constructor(x, y){
public y: number;
constructor(x: number, y: number){
this.x = x, this.x = x,
this.y = y this.y = y
} }
static eq(x: number, y: number) { static eq(x, y) {
return x === y; return x === y;
} }
} }
class Rectangle2 { class Rectangle2 {
public x: number; constructor(x, y){
public y: number;
constructor(x: number, y: number){
this.x = x, this.x = x,
this.y = y this.y = y
} }
static eq(x: number, y: number) { static eq(x, y) {
return x === y; return x === y;
} }
@ -166,7 +157,7 @@ fn define_property() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -200,7 +191,7 @@ fn delete_property() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -243,7 +234,7 @@ fn get() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -283,7 +274,7 @@ fn get_own_property_descriptor() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -320,7 +311,7 @@ fn get_prototype_of() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -329,7 +320,7 @@ fn get_prototype_of() {
const object = { const object = {
property: 42 property: 42
}; };
const array: number[] = [1, 2, 3]; const array = [1, 2, 3];
assert.equal(wasm.get_prototype_of(object), Object.prototype); assert.equal(wasm.get_prototype_of(object), Object.prototype);
assert.equal(wasm.get_prototype_of(array), Array.prototype); assert.equal(wasm.get_prototype_of(array), Array.prototype);
@ -358,7 +349,7 @@ fn has() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -367,7 +358,7 @@ fn has() {
const object = { const object = {
property: 42 property: 42
}; };
const array: number[] = [1, 2, 3, 4] const array = [1, 2, 3, 4]
assert.equal(wasm.has(object, "property"), true); assert.equal(wasm.has(object, "property"), true);
assert.equal(wasm.has(object, "foo"), false); assert.equal(wasm.has(object, "foo"), false);
@ -398,7 +389,7 @@ fn is_extensible() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -442,7 +433,7 @@ fn own_keys() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -451,7 +442,7 @@ fn own_keys() {
const object = { const object = {
property: 42 property: 42
}; };
const array: number[] = []; const array = [];
assert.equal(wasm.own_keys(object)[0], "property"); assert.equal(wasm.own_keys(object)[0], "property");
assert.equal(wasm.own_keys(array)[0], "length"); assert.equal(wasm.own_keys(array)[0], "length");
@ -480,7 +471,7 @@ fn prevent_extensions() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
@ -516,14 +507,14 @@ fn set() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
export function test() { export function test() {
const object = {}; const object = {};
const array: number[] = [1, 2, 3, 4]; const array = [1, 2, 3, 4];
assert.equal(wasm.set(object, "key", "value"), true); assert.equal(wasm.set(object, "key", "value"), true);
assert.equal(wasm.set(array, 0, 100), true); assert.equal(wasm.set(array, 0, 100), true);
@ -554,14 +545,14 @@ fn set_with_receiver() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";
export function test() { export function test() {
const object = {}; const object = {};
const array: number[] = [1, 2, 3, 4]; const array = [1, 2, 3, 4];
assert.equal(wasm.set_with_receiver({}, "key", "value", object), true); assert.equal(wasm.set_with_receiver({}, "key", "value", object), true);
assert.equal(wasm.set_with_receiver([], 0, 100, array), true); assert.equal(wasm.set_with_receiver([], 0, 100, array), true);
@ -592,7 +583,7 @@ fn set_prototype_of() {
"#, "#,
) )
.file( .file(
"test.ts", "test.js",
r#" r#"
import * as assert from "assert"; import * as assert from "assert";
import * as wasm from "./out"; import * as wasm from "./out";