Skip to content

Commit

Permalink
Merge branch 'master' into features/bigint-parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
surma committed Oct 14, 2019
2 parents 12450a4 + a1d6719 commit d5c3047
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,28 @@ process.on("unhandledRejection", err => {
const features = require(__dirname+'/../dist/cjs');

const isBoolean = function (value) {
return value === true || value === false;
return typeof value === 'boolean';
}

const checkFeature = function (featureName) {
const checkFeature = async function (featureName) {
const feature = features[featureName];
assert(feature, `The feature ${featureName} doesn't exist`);
feature().then(function(result) {
console.log(`The feature ${featureName} returned: ${result}`);
assert(isBoolean(result), `The feature ${featureName} returned: ${result}`);
})
const result = await feature();
console.log(`The feature ${featureName} returned: ${result}`);
assert(isBoolean(result), `The feature ${featureName} returned: ${result}`);
}

checkFeature("bulkMemory");
checkFeature("exceptions");
checkFeature("multiValue");
checkFeature("mutableGlobals");
checkFeature("referenceTypes");
checkFeature("saturatedFloatToInt");
checkFeature("signExtensions");
checkFeature("simd");
checkFeature("tailCall");
checkFeature("threads");
checkFeature("bigintParameters");
async function run() {
await checkFeature("bulkMemory");
await checkFeature("exceptions");
await checkFeature("multiValue");
await checkFeature("mutableGlobals");
await checkFeature("referenceTypes");
await checkFeature("saturatedFloatToInt");
await checkFeature("signExtensions");
await checkFeature("simd");
await checkFeature("tailCall");
await checkFeature("threads");
}

run();

0 comments on commit d5c3047

Please sign in to comment.