| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 
| 3  * Copyright (C) 2006-2015 Eyeo GmbH | 3  * Copyright (C) 2006-2015 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 204     obj2.bar = obj1; | 204     obj2.bar = obj1; | 
| 205     ok(obj1.equals(obj2.bar), "Object equal to reference to itself"); | 205     ok(obj1.equals(obj2.bar), "Object equal to reference to itself"); | 
| 206     ok(obj2.bar.equals(obj1), "Object equal to reference to itself"); | 206     ok(obj2.bar.equals(obj1), "Object equal to reference to itself"); | 
| 207     ok(obj2.bar.equals(obj2.bar), "Object reference equals to itself"); | 207     ok(obj2.bar.equals(obj2.bar), "Object reference equals to itself"); | 
| 208 | 208 | 
| 209     let obj5 = type2(); | 209     let obj5 = type2(); | 
| 210     obj5.bar = null; | 210     obj5.bar = null; | 
| 211     ok(!obj2.bar.equals(obj5.bar), "Object reference not equal to null reference
     "); | 211     ok(!obj2.bar.equals(obj5.bar), "Object reference not equal to null reference
     "); | 
| 212 | 212 | 
| 213     obj5.bar = obj3; | 213     obj5.bar = obj3; | 
| 214     ok(!obj2.bar.equals(obj5.bar), "Object reference not equal to reference to a
     nother object") | 214     ok(!obj2.bar.equals(obj5.bar), "Object reference not equal to reference to a
     nother object"); | 
| 215     ok(!obj5.bar.equals(obj2.bar), "Object reference not equal to reference to a
     nother object") | 215     ok(!obj5.bar.equals(obj2.bar), "Object reference not equal to reference to a
     nother object"); | 
| 216   }); | 216   }); | 
| 217 | 217 | 
| 218   test("Object inheritance", function() | 218   test("Object inheritance", function() | 
| 219   { | 219   { | 
| 220     let {ObjectType, uint8, float32} = require("typedObjects"); | 220     let {ObjectType, uint8, float32} = require("typedObjects"); | 
| 221 | 221 | 
| 222     // Property inheritance | 222     // Property inheritance | 
| 223     let type1 = new ObjectType({ | 223     let type1 = new ObjectType({ | 
| 224       foo: uint8 | 224       foo: uint8 | 
| 225     }); | 225     }); | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 264     let obj4 = type4(2); | 264     let obj4 = type4(2); | 
| 265     equal(obj3.x, 2, "Superclass constructor executed correctly"); | 265     equal(obj3.x, 2, "Superclass constructor executed correctly"); | 
| 266     equal(obj4.x, 6, "Subclass constructor executed correctly"); | 266     equal(obj4.x, 6, "Subclass constructor executed correctly"); | 
| 267 | 267 | 
| 268     equal(typeof obj3.foo, "function", "Superclass method exists in superclass")
     ; | 268     equal(typeof obj3.foo, "function", "Superclass method exists in superclass")
     ; | 
| 269     equal(typeof obj3.bar, "undefined", "Subclass method doesn't exist in superc
     lass"); | 269     equal(typeof obj3.bar, "undefined", "Subclass method doesn't exist in superc
     lass"); | 
| 270     equal(typeof obj4.foo, "function", "Superclass method exists in subclass"); | 270     equal(typeof obj4.foo, "function", "Superclass method exists in subclass"); | 
| 271     equal(typeof obj4.bar, "function", "Subclass method exists in subclass"); | 271     equal(typeof obj4.bar, "function", "Subclass method exists in subclass"); | 
| 272 | 272 | 
| 273     equal(obj3.foo(4), 8, "Superclass method executed correctly"); | 273     equal(obj3.foo(4), 8, "Superclass method executed correctly"); | 
| 274     equal(obj4.foo(4), 30, "Overridden superclass method executed correctly") | 274     equal(obj4.foo(4), 30, "Overridden superclass method executed correctly"); | 
| 275 | 275 | 
| 276     let type5 = type3.extend({ | 276     let type5 = type3.extend({ | 
| 277       y: uint8 | 277       y: uint8 | 
| 278     }); | 278     }); | 
| 279     let obj5 = type5(4); | 279     let obj5 = type5(4); | 
| 280     equal(obj5.x, 4, "Superclass constructor is called even if subclass has no c
     onstructor"); | 280     equal(obj5.x, 4, "Superclass constructor is called even if subclass has no c
     onstructor"); | 
| 281 | 281 | 
| 282     // Untypical overrides | 282     // Untypical overrides | 
| 283     type3.extend({x: uint8}); | 283     type3.extend({x: uint8}); | 
| 284     ok(true, "Overriding property without changing type"); | 284     ok(true, "Overriding property without changing type"); | 
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 802     s11.release(); | 802     s11.release(); | 
| 803 | 803 | 
| 804     let s12 = string(s8, 4); | 804     let s12 = string(s8, 4); | 
| 805     ok(s12, "String created as typed substring without length parameter"); | 805     ok(s12, "String created as typed substring without length parameter"); | 
| 806     equal(s12.length, 10, "String length set correctly"); | 806     equal(s12.length, 10, "String length set correctly"); | 
| 807     equal(s12.toString(), "longstring", "JavaScript representation is correct"); | 807     equal(s12.toString(), "longstring", "JavaScript representation is correct"); | 
| 808     s12.release(); | 808     s12.release(); | 
| 809     s8.release(); | 809     s8.release(); | 
| 810   }); | 810   }); | 
| 811 })(); | 811 })(); | 
| OLD | NEW | 
|---|