Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
test: fixing test breaks for chakracore
Browse files Browse the repository at this point in the history
* test-console: added specific message
* test-windows-failed-heap-allocation: skipped due to V8 option
  max-old-space-size
* n-api: added implementation for new number APIs
* test-require-json: added specific message
* test-util-internal: added common require
* test-inspector: added specific message

n-api,test: fixing test failures
  • Loading branch information
Jack Horton authored and Jack Horton committed Aug 10, 2017
1 parent e813471 commit 243ce93
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 8 deletions.
28 changes: 27 additions & 1 deletion src/node_api_jsrt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1122,14 +1122,40 @@ napi_status napi_create_string_utf16(napi_env env,
return napi_ok;
}

napi_status napi_create_number(napi_env env,
napi_status napi_create_double(napi_env env,
double value,
napi_value* result) {
CHECK_ARG(result);
CHECK_JSRT(JsDoubleToNumber(value, reinterpret_cast<JsValueRef*>(result)));
return napi_ok;
}

napi_status napi_create_int32(napi_env env,
int32_t value,
napi_value* result) {
CHECK_ARG(result);
CHECK_JSRT(JsIntToNumber(value, reinterpret_cast<JsValueRef*>(result)));
return napi_ok;
}

napi_status napi_create_uint32(napi_env env,
uint32_t value,
napi_value* result) {
CHECK_ARG(result);
CHECK_JSRT(JsDoubleToNumber(static_cast<double>(value),
reinterpret_cast<JsValueRef*>(result)));
return napi_ok;
}

napi_status napi_create_int64(napi_env env,
int64_t value,
napi_value* result) {
CHECK_ARG(result);
CHECK_JSRT(JsDoubleToNumber(static_cast<double>(value),
reinterpret_cast<JsValueRef*>(result)));
return napi_ok;
}

napi_status napi_get_boolean(napi_env env, bool value, napi_value* result) {
CHECK_ARG(result);
CHECK_JSRT(JsBoolToBoolean(value, reinterpret_cast<JsValueRef*>(result)));
Expand Down
5 changes: 4 additions & 1 deletion test/inspector/test-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,10 @@ function testCommandLineAPI(session) {
checkException(message);
assert.deepStrictEqual(JSON.parse(message['result']['value']), {
parentsEqual: true,
parentId: common.engineSpecificMessage({chakracore: '.', v8: '<inspector console>'})
parentId: common.engineSpecificMessage({
v8: '<inspector console>',
chakracore: '.'
})
});
}
],
Expand Down
16 changes: 12 additions & 4 deletions test/parallel/test-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,18 @@ assert.doesNotThrow(function() {
console.timeEnd('label');
});

assert.throws(() => console.time(Symbol('test')),
/^TypeError: Cannot convert a Symbol value to a string$/);
assert.throws(() => console.timeEnd(Symbol('test')),
/^TypeError: Cannot convert a Symbol value to a string$/);
assert.throws(
() => console.time(Symbol('test')),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: Object doesn't support property or method 'ToString'$/
}));
assert.throws(
() => console.timeEnd(Symbol('test')),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: Object doesn't support property or method 'ToString'$/
}));


// an Object with a custom .inspect() function
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-require-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const fixtures = require('../common/fixtures');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-util-internal.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
// Flags: --expose_internals

require('../common');
const common = require('../common');
const assert = require('assert');
const fixtures = require('../common/fixtures');

Expand Down
4 changes: 4 additions & 0 deletions test/parallel/test-windows-failed-heap-allocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ const common = require('../common');

if (!common.isWindows) return common.skip('Windows-only');

if (common.isChakraEngine)
common.skip('This test is disabled for chakra engine because it depends ' +
'on v8-option --max-old-space-size');

const assert = require('assert');
const { exec } = require('child_process');

Expand Down

0 comments on commit 243ce93

Please sign in to comment.