LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 bar: float32 | 228 bar: float32 |
229 }); | 229 }); |
230 | 230 |
231 let obj1 = type1(); | 231 let obj1 = type1(); |
232 let obj2 = type2(); | 232 let obj2 = type2(); |
233 ok("foo" in obj1, "Superclass property exists in superclass"); | 233 ok("foo" in obj1, "Superclass property exists in superclass"); |
234 ok(!("bar" in obj1), "Subclass property doesn't exist in superclass"); | 234 ok(!("bar" in obj1), "Subclass property doesn't exist in superclass"); |
235 ok("foo" in obj2, "Superclass property exists in subclass"); | 235 ok("foo" in obj2, "Superclass property exists in subclass"); |
236 ok("bar" in obj2, "Subclass property exists in subclass"); | 236 ok("bar" in obj2, "Subclass property exists in subclass"); |
237 | 237 |
238 ok(type1.isinstance(obj1), "Object is recognized as instance of its class"); | 238 ok(type1.isInstance(obj1), "Object is recognized as instance of its class"); |
239 ok(type1.isinstance(obj2), "Object is recognized as instance of its supercla
ss"); | 239 ok(type1.isInstance(obj2), "Object is recognized as instance of its supercla
ss"); |
240 ok(!type2.isinstance(obj1), "Object isn't an instance of its subclass"); | 240 ok(!type2.isInstance(obj1), "Object isn't an instance of its subclass"); |
241 ok(type2.isinstance(obj2), "Object is recognized as instance of its class"); | 241 ok(type2.isInstance(obj2), "Object is recognized as instance of its class"); |
242 | 242 |
243 // Method and constructor inheritance | 243 // Method and constructor inheritance |
244 let type3 = new ObjectType({ | 244 let type3 = new ObjectType({ |
245 x: uint8, | 245 x: uint8, |
246 foo: function(n) {return this.x * n;} | 246 foo: function(n) {return this.x * n;} |
247 }, { | 247 }, { |
248 constructor: function(x) | 248 constructor: function(x) |
249 { | 249 { |
250 this.x = x; | 250 this.x = x; |
251 } | 251 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 { | 293 { |
294 type3.extend({foo: uint8}); | 294 type3.extend({foo: uint8}); |
295 }, "Property masks method"); | 295 }, "Property masks method"); |
296 | 296 |
297 throws(function() | 297 throws(function() |
298 { | 298 { |
299 type3.extend({x: function() {}}); | 299 type3.extend({x: function() {}}); |
300 }, "Method masks property"); | 300 }, "Method masks property"); |
301 }); | 301 }); |
302 })(); | 302 })(); |
LEFT | RIGHT |