"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/node_modules/inherits/test.js" (8 Mar 2017, 510 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 var inherits = require('./inherits.js')
    2 var assert = require('assert')
    3 
    4 function test(c) {
    5   assert(c.constructor === Child)
    6   assert(c.constructor.super_ === Parent)
    7   assert(Object.getPrototypeOf(c) === Child.prototype)
    8   assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype)
    9   assert(c instanceof Child)
   10   assert(c instanceof Parent)
   11 }
   12 
   13 function Child() {
   14   Parent.call(this)
   15   test(this)
   16 }
   17 
   18 function Parent() {}
   19 
   20 inherits(Child, Parent)
   21 
   22 var c = new Child
   23 test(c)
   24 
   25 console.log('ok')