2424// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2525// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+ 'use strict' ;
2728
2829const common = require ( '../../common' ) ;
2930const addon = require ( `./build/${ common . buildType } /test_general` ) ;
3031const assert = require ( 'assert' ) ;
3132
3233// The following assert functions are referenced by v8's unit tests
3334// See for instance deps/v8/test/mjsunit/instanceof.js
34- // eslint-disable-next-line no-unused-vars
35+
3536function assertTrue ( assertion ) {
3637 return assert . strictEqual ( assertion , true ) ;
3738}
3839
39- // eslint-disable-next-line no-unused-vars
40+
4041function assertFalse ( assertion ) {
4142 assert . strictEqual ( assertion , false ) ;
4243}
4344
44- // eslint-disable-next-line no-unused-vars
45+
4546function assertEquals ( leftHandSide , rightHandSide ) {
4647 assert . strictEqual ( leftHandSide , rightHandSide ) ;
4748}
4849
49- // eslint-disable-next-line no-unused-vars
50+
5051function assertThrows ( statement ) {
5152 assert . throws ( function ( ) {
5253 eval ( statement ) ;
@@ -60,11 +61,11 @@ assertFalse(addon.doInstanceOf({}, Array));
6061assertTrue ( addon . doInstanceOf ( [ ] , Array ) ) ;
6162
6263function TestChains ( ) {
63- var A = { } ;
64- var B = { } ;
65- var C = { } ;
66- B . __proto__ = A ;
67- C . __proto__ = B ;
64+ const A = { } ;
65+ const B = { } ;
66+ const C = { } ;
67+ Object . setPrototypeOf ( B , A ) ;
68+ Object . setPrototypeOf ( C , B ) ;
6869
6970 function F ( ) { }
7071 F . prototype = A ;
@@ -88,18 +89,18 @@ TestChains();
8889
8990function TestExceptions ( ) {
9091 function F ( ) { }
91- var items = [ 1 , new Number ( 42 ) ,
92- true ,
93- 'string' , new String ( 'hest' ) ,
94- { } , [ ] ,
95- F , new F ( ) ,
96- Object , String ] ;
97-
98- var exceptions = 0 ;
99- var instanceofs = 0 ;
100-
101- for ( var i = 0 ; i < items . length ; i ++ ) {
102- for ( var j = 0 ; j < items . length ; j ++ ) {
92+ const items = [ 1 , new Number ( 42 ) ,
93+ true ,
94+ 'string' , new String ( 'hest' ) ,
95+ { } , [ ] ,
96+ F , new F ( ) ,
97+ Object , String ] ;
98+
99+ let exceptions = 0 ;
100+ let instanceofs = 0 ;
101+
102+ for ( let i = 0 ; i < items . length ; i ++ ) {
103+ for ( let j = 0 ; j < items . length ; j ++ ) {
103104 try {
104105 if ( addon . doInstanceOf ( items [ i ] , items [ j ] ) ) instanceofs ++ ;
105106 } catch ( e ) {
@@ -115,7 +116,7 @@ function TestExceptions() {
115116 // isn't a proper JavaScript object.
116117 function G ( ) { }
117118 G . prototype = undefined ;
118- assertThrows ( " addon.doInstanceOf({}, G)" ) ;
119+ assertThrows ( ' addon.doInstanceOf({}, G)' ) ;
119120}
120121
121122TestExceptions ( ) ;
0 commit comments