diff options
author | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2018-11-17 12:34:54 -0800 |
---|---|---|
committer | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2018-12-04 13:58:17 -0800 |
commit | 938e11882b96e19b443477571455088baaa054d8 (patch) | |
tree | eb828a60957a2881995ba9a83f44a32a18fbff16 /test/js-native-api/test_symbol/test1.js | |
parent | 83ee137c4565112177f22f2c735b266b22262220 (diff) | |
download | android-node-v8-938e11882b96e19b443477571455088baaa054d8.tar.gz android-node-v8-938e11882b96e19b443477571455088baaa054d8.tar.bz2 android-node-v8-938e11882b96e19b443477571455088baaa054d8.zip |
test: partition N-API tests
Partition test/addons-napi into test/js-native-api and test/node-api to
isolate the Node.js-agnostic portion of the N-API tests from the
Node.js-specific portion.
PR-URL: https://github.com/nodejs/node/pull/24557
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'test/js-native-api/test_symbol/test1.js')
-rw-r--r-- | test/js-native-api/test_symbol/test1.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/js-native-api/test_symbol/test1.js b/test/js-native-api/test_symbol/test1.js new file mode 100644 index 0000000000..9232210c46 --- /dev/null +++ b/test/js-native-api/test_symbol/test1.js @@ -0,0 +1,19 @@ +'use strict'; +const common = require('../../common'); +const assert = require('assert'); + +// testing api calls for symbol +const test_symbol = require(`./build/${common.buildType}/test_symbol`); + +const sym = test_symbol.New('test'); +assert.strictEqual(sym.toString(), 'Symbol(test)'); + +const myObj = {}; +const fooSym = test_symbol.New('foo'); +const otherSym = test_symbol.New('bar'); +myObj.foo = 'bar'; +myObj[fooSym] = 'baz'; +myObj[otherSym] = 'bing'; +assert.strictEqual(myObj.foo, 'bar'); +assert.strictEqual(myObj[fooSym], 'baz'); +assert.strictEqual(myObj[otherSym], 'bing'); |