Skip to content

Commit 785c38f

Browse files
committed
Add test for Object::Object empty constructor
1 parent cdd5c9f commit 785c38f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

test/object/object.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ Value TestFunctionWithUserData(const CallbackInfo& info) {
6969
return Number::New(info.Env(), holder->value);
7070
}
7171

72+
Value GetEmptyConstructor(const CallbackInfo& /*info*/) {
73+
return Object();
74+
}
75+
7276
Array GetPropertyNames(const CallbackInfo& info) {
7377
Object obj = info[0].As<Object>();
7478
Array arr = obj.GetPropertyNames();
@@ -237,6 +241,8 @@ Value InstanceOf(const CallbackInfo& info) {
237241
Object InitObject(Env env) {
238242
Object exports = Object::New(env);
239243

244+
exports["getEmptyConstructor"] = Function::New(env, GetEmptyConstructor);
245+
240246
exports["GetPropertyNames"] = Function::New(env, GetPropertyNames);
241247
exports["defineProperties"] = Function::New(env, DefineProperties);
242248
exports["defineValueProperty"] = Function::New(env, DefineValueProperty);

test/object/object.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ function test(binding) {
102102
testDefineProperties('string');
103103
testDefineProperties('value');
104104

105+
{
106+
const expected = undefined;
107+
const actual = binding.object.getEmptyConstructor();
108+
assert.strictEqual(actual, expected);
109+
}
110+
105111
{
106112
const obj = {};
107113
const testSym = Symbol();

0 commit comments

Comments
 (0)