| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // Flags: --expose-debug-as debug | |
| 29 // Get the Debug object exposed from the debug context global object. | |
| 30 Debug = debug.Debug; | 28 Debug = debug.Debug; |
| 31 | 29 |
| 32 var test_name; | 30 var test_name; |
| 33 var listener_delegate; | 31 var listener_delegate; |
| 34 var listener_called; | 32 var listener_called; |
| 35 var exception; | 33 var exception; |
| 36 var expected_receiver; | 34 var expected_receiver; |
| 37 var begin_test_count = 0; | 35 var begin_test_count = 0; |
| 38 var end_test_count = 0; | 36 var end_test_count = 0; |
| 39 var break_count = 0; | 37 var break_count = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 61 function BeginTest(name) { | 59 function BeginTest(name) { |
| 62 test_name = name; | 60 test_name = name; |
| 63 listener_called = false; | 61 listener_called = false; |
| 64 exception = null; | 62 exception = null; |
| 65 begin_test_count++; | 63 begin_test_count++; |
| 66 } | 64 } |
| 67 | 65 |
| 68 | 66 |
| 69 // Check result of a test. | 67 // Check result of a test. |
| 70 function EndTest() { | 68 function EndTest() { |
| 71 assertTrue(listener_called, "listerner not called for " + test_name); | 69 assertTrue(listener_called, "listener not called for " + test_name); |
| 72 assertNull(exception, test_name); | 70 assertNull(exception, test_name); |
| 73 end_test_count++; | 71 end_test_count++; |
| 74 } | 72 } |
| 75 | 73 |
| 76 | 74 |
| 77 // Check that the debugger correctly reflects that the receiver is not | 75 // Check that the debugger correctly reflects that the receiver is not |
| 78 // converted to object for strict mode functions. | 76 // converted to object for strict mode functions. |
| 79 function Strict() { "use strict"; debugger; } | 77 function Strict() { "use strict"; debugger; } |
| 80 function TestStrict(receiver) { | 78 function TestStrict(receiver) { |
| 81 expected_receiver = receiver; | 79 expected_receiver = receiver; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 BeginTest("non-strict: 1"); TestNonStrict(1); EndTest(); | 113 BeginTest("non-strict: 1"); TestNonStrict(1); EndTest(); |
| 116 BeginTest("non-strict: 1.2"); TestNonStrict(1.2); EndTest(); | 114 BeginTest("non-strict: 1.2"); TestNonStrict(1.2); EndTest(); |
| 117 BeginTest("non-strict: 'asdf'"); TestNonStrict('asdf'); EndTest(); | 115 BeginTest("non-strict: 'asdf'"); TestNonStrict('asdf'); EndTest(); |
| 118 BeginTest("non-strict: true"); TestNonStrict(true); EndTest(); | 116 BeginTest("non-strict: true"); TestNonStrict(true); EndTest(); |
| 119 | 117 |
| 120 | 118 |
| 121 assertEquals(begin_test_count, break_count, | 119 assertEquals(begin_test_count, break_count, |
| 122 'one or more tests did not enter the debugger'); | 120 'one or more tests did not enter the debugger'); |
| 123 assertEquals(begin_test_count, end_test_count, | 121 assertEquals(begin_test_count, end_test_count, |
| 124 'one or more tests did not have its result checked'); | 122 'one or more tests did not have its result checked'); |
| OLD | NEW |