@ -4,7 +4,6 @@
const common = require ( '../common' ) ;
const path = require ( 'path' ) ;
const assert = require ( 'assert' ) ;
const internalUtil = require ( 'internal/util' ) ;
const spawnSync = require ( 'child_process' ) . spawnSync ;
const binding = process . binding ( 'util' ) ;
@ -12,13 +11,13 @@ const kArrowMessagePrivateSymbolIndex = binding['arrow_message_private_symbol'];
function getHiddenValue ( obj , index ) {
return function ( ) {
internalUtil . getHiddenValue ( obj , index ) ;
binding . getHiddenValue ( obj , index ) ;
} ;
}
function setHiddenValue ( obj , index , val ) {
return function ( ) {
internalUtil . setHiddenValue ( obj , index , val ) ;
binding . setHiddenValue ( obj , index , val ) ;
} ;
}
@ -31,7 +30,7 @@ assert.throws(getHiddenValue({}), /index must be an uint32/);
assert . throws ( getHiddenValue ( { } , null ) , /index must be an uint32/ ) ;
assert . throws ( getHiddenValue ( { } , [ ] ) , /index must be an uint32/ ) ;
assert . deepStrictEqual (
internalUtil . getHiddenValue ( { } , kArrowMessagePrivateSymbolIndex ) ,
binding . getHiddenValue ( { } , kArrowMessagePrivateSymbolIndex ) ,
undefined ) ;
assert . throws ( setHiddenValue ( ) , /obj must be an object/ ) ;
@ -44,10 +43,10 @@ assert.throws(setHiddenValue({}, null), /index must be an uint32/);
assert . throws ( setHiddenValue ( { } , [ ] ) , /index must be an uint32/ ) ;
const obj = { } ;
assert . strictEqual (
internalUtil . setHiddenValue ( obj , kArrowMessagePrivateSymbolIndex , 'bar' ) ,
binding . setHiddenValue ( obj , kArrowMessagePrivateSymbolIndex , 'bar' ) ,
true ) ;
assert . strictEqual (
internalUtil . getHiddenValue ( obj , kArrowMessagePrivateSymbolIndex ) ,
binding . getHiddenValue ( obj , kArrowMessagePrivateSymbolIndex ) ,
'bar' ) ;
let arrowMessage ;
@ -56,7 +55,7 @@ try {
require ( path . join ( common . fixturesDir , 'syntax' , 'bad_syntax' ) ) ;
} catch ( err ) {
arrowMessage =
internalUtil . getHiddenValue ( err , kArrowMessagePrivateSymbolIndex ) ;
binding . getHiddenValue ( err , kArrowMessagePrivateSymbolIndex ) ;
}
assert ( /bad_syntax\.js:1/ . test ( arrowMessage ) ) ;