forked from nodejs/node-addon-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubscript_operator.js
More file actions
17 lines (13 loc) · 823 Bytes
/
subscript_operator.js
File metadata and controls
17 lines (13 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';
const assert = require('assert');
module.exports = require('../common').runTest(test);
function test (binding) {
function testProperty (obj, key, value, nativeGetProperty, nativeSetProperty) {
nativeSetProperty(obj, key, value);
assert.strictEqual(nativeGetProperty(obj, key), value);
}
testProperty({}, 'key', 'value', binding.object.subscriptGetWithCStyleString, binding.object.subscriptSetWithCStyleString);
testProperty({ key: 'override me' }, 'key', 'value', binding.object.subscriptGetWithCppStyleString, binding.object.subscriptSetWithCppStyleString);
testProperty({}, 0, 'value', binding.object.subscriptGetAtIndex, binding.object.subscriptSetAtIndex);
testProperty({ key: 'override me' }, 0, 'value', binding.object.subscriptGetAtIndex, binding.object.subscriptSetAtIndex);
}