File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
graal-nodejs/test/graal/unit Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,12 @@ EXPORT_TO_JS(IsName) {
269269 args.GetReturnValue ().Set (args[0 ]->IsName ());
270270}
271271
272+ // Value::IsWasmMemoryObject
273+
274+ EXPORT_TO_JS (IsWasmMemoryObject) {
275+ args.GetReturnValue ().Set (args[0 ]->IsWasmMemoryObject ());
276+ }
277+
272278// more tests for Value::IsExternal in external.cc
273279
274280// Value::IsNativeError
Original file line number Diff line number Diff line change @@ -545,6 +545,27 @@ describe('Value - Is*()', function () {
545545 assert . strictEqual ( module . Value_IsName ( 42 ) , false ) ;
546546 } ) ;
547547 } ) ;
548+ describe ( 'IsWasmMemoryObject' , function ( ) {
549+ it ( 'should return false for undefined' , function ( ) {
550+ assert . strictEqual ( module . Value_IsWasmMemoryObject ( undefined ) , false ) ;
551+ } ) ;
552+ it ( 'should return false for an ordinary object' , function ( ) {
553+ assert . strictEqual ( module . Value_IsWasmMemoryObject ( { } ) , false ) ;
554+ } ) ;
555+ if ( typeof WebAssembly !== 'undefined' ) {
556+ it ( 'should return false for WebAssembly object' , function ( ) {
557+ assert . strictEqual ( module . Value_IsWasmMemoryObject ( WebAssembly ) , false ) ;
558+ } ) ;
559+ it ( 'should return true for WebAssembly.Memory object' , function ( ) {
560+ let memory = new WebAssembly . Memory ( { initial : 1 } ) ;
561+ assert . strictEqual ( module . Value_IsWasmMemoryObject ( memory ) , true ) ;
562+ } ) ;
563+ it ( 'should return false for WebAssembly.Global object' , function ( ) {
564+ let wasmGlobal = new WebAssembly . Global ( { value : 'i32' } ) ;
565+ assert . strictEqual ( module . Value_IsWasmMemoryObject ( wasmGlobal ) , false ) ;
566+ } ) ;
567+ }
568+ } ) ;
548569} ) ;
549570
550571describe ( 'Value - *Value()' , function ( ) {
You can’t perform that action at this time.
0 commit comments