diff options
author | haturau <135221985+haturatu@users.noreply.github.com> | 2024-11-20 01:20:47 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 01:20:47 +0900 |
commit | 85719a67e59c7aa45bead26e4942d7df8b1b42d4 (patch) | |
tree | face0aecaac53e93ce2f23b53c48859bcf1a36ec /tests/napi/object_test.js | |
parent | 67697bc2e4a62a9670699fd18ad0dd8efc5bd955 (diff) | |
parent | 186b52731c6bb326c4d32905c5e732d082e83465 (diff) |
Merge branch 'denoland:main' into main
Diffstat (limited to 'tests/napi/object_test.js')
-rw-r--r-- | tests/napi/object_test.js | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/napi/object_test.js b/tests/napi/object_test.js index 4bc5c3c9c..6226b0138 100644 --- a/tests/napi/object_test.js +++ b/tests/napi/object_test.js @@ -1,6 +1,11 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { assert, assertEquals, loadTestLibrary } from "./common.js"; +import { + assert, + assertEquals, + assertThrows, + loadTestLibrary, +} from "./common.js"; const object = loadTestLibrary(); @@ -12,4 +17,22 @@ Deno.test("napi object", function () { const r1 = object.test_object_get(r); assert(r === r1); + + const r2 = object.test_object_attr_property(r); + assert(r === r2); + assertThrows( + () => { + r2.self = "2"; + }, + Error, + "Cannot assign to read only property 'self' of object '#<Object>'", + ); + + assertThrows( + () => { + r2.method = () => {}; + }, + Error, + "Cannot assign to read only property 'method' of object '#<Object>'", + ); }); |