test/script/basic/JDK-8024174.js

Print this page




  29 
  30 var p = { foo: function() { print("p.foo"); } };
  31 
  32 var obj = {
  33     __proto__ : p,
  34     bar: 44
  35 };
  36 
  37 if (obj.__proto__ !== p || Object.getPrototypeOf(obj) !== p) {
  38     fail("obj.__proto__ was not set inside literal");
  39 }
  40 
  41 if (typeof(obj.foo) !== 'function' || obj.foo !== p.foo) {
  42     fail("'obj' failed to inherit 'foo' from 'p'");
  43 }
  44 
  45 var obj2 = {
  46     __proto__: null
  47 };
  48 
  49 if (obj2.__proto__ !== null || Object.getPrototypeOf(obj2) !== null) {
  50     fail("obj2.__proto__ was not set to null inside literal");
  51 }


  29 
  30 var p = { foo: function() { print("p.foo"); } };
  31 
  32 var obj = {
  33     __proto__ : p,
  34     bar: 44
  35 };
  36 
  37 if (obj.__proto__ !== p || Object.getPrototypeOf(obj) !== p) {
  38     fail("obj.__proto__ was not set inside literal");
  39 }
  40 
  41 if (typeof(obj.foo) !== 'function' || obj.foo !== p.foo) {
  42     fail("'obj' failed to inherit 'foo' from 'p'");
  43 }
  44 
  45 var obj2 = {
  46     __proto__: null
  47 };
  48 
  49 if (Object.getPrototypeOf(obj2) !== null) {
  50     fail("obj2.__proto__ was not set to null inside literal");
  51 }