| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 var y = new Object(); | 42 var y = new Object(); |
| 43 y.a = 7; | 43 y.a = 7; |
| 44 y.b = function() { return 42; }; | 44 y.b = function() { return 42; }; |
| 45 y.c = 12 * y.a; | 45 y.c = 12 * y.a; |
| 46 y.d = "A Man Called Horse"; | 46 y.d = "A Man Called Horse"; |
| 47 | 47 |
| 48 assertEquals(84, y.c); | 48 assertEquals(84, y.c); |
| 49 | 49 |
| 50 var z = new Object(); | 50 var z = new Object(); |
| 51 z.a = 3; | 51 z.a = 3; |
| 52 function forty_two() { return 42; }; | 52 function forty_two() { return 42; } |
| 53 z.a += 4; | 53 z.a += 4; |
| 54 z.b = forty_two; | 54 z.b = forty_two; |
| 55 z.c = 12; | 55 z.c = 12; |
| 56 z.c *= z.a; | 56 z.c *= z.a; |
| 57 z.d = "A Man Called Horse"; | 57 z.d = "A Man Called Horse"; |
| 58 | 58 |
| 59 assertEquals(84, z.c); | 59 assertEquals(84, z.c); |
| 60 | 60 |
| 61 var x1 = new Object(); | 61 var x1 = new Object(); |
| 62 var x2 = new Object(); | 62 var x2 = new Object(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 89 Calculator.prototype.product = function() { return this.x * this.y; }; | 89 Calculator.prototype.product = function() { return this.x * this.y; }; |
| 90 Calculator.prototype.quotient = function() { return this.x / this.y; }; | 90 Calculator.prototype.quotient = function() { return this.x / this.y; }; |
| 91 | 91 |
| 92 var calc = new Calculator(20, 10); | 92 var calc = new Calculator(20, 10); |
| 93 assertEquals(30, calc.sum()); | 93 assertEquals(30, calc.sum()); |
| 94 assertEquals(10, calc.difference()); | 94 assertEquals(10, calc.difference()); |
| 95 assertEquals(200, calc.product()); | 95 assertEquals(200, calc.product()); |
| 96 assertEquals(2, calc.quotient()); | 96 assertEquals(2, calc.quotient()); |
| 97 | 97 |
| 98 var x = new Object(); | 98 var x = new Object(); |
| 99 x.__defineGetter__('a', function() { return 7 }); | 99 x.__defineGetter__('a', function() { return 7; }); |
| 100 x.b = function() { return 42; }; | 100 x.b = function() { return 42; }; |
| 101 x.c = 88; | 101 x.c = 88; |
| 102 x.d = "A Man Called Horse"; | 102 x.d = "A Man Called Horse"; |
| 103 | 103 |
| 104 assertEquals(7, x.a); | 104 assertEquals(7, x.a); |
| 105 assertEquals(42, x.b()); | 105 assertEquals(42, x.b()); |
| 106 assertEquals(88, x.c); | 106 assertEquals(88, x.c); |
| 107 assertEquals("A Man Called Horse", x.d); | 107 assertEquals("A Man Called Horse", x.d); |
| OLD | NEW |