| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Get the Debug object exposed from the debug context global object. | 59 // Get the Debug object exposed from the debug context global object. |
| 60 Debug = debug.Debug | 60 Debug = debug.Debug |
| 61 | 61 |
| 62 // This is the number of comment lines above the first test function. | 62 // This is the number of comment lines above the first test function. |
| 63 var comment_lines = 29; | 63 var comment_lines = 29; |
| 64 | 64 |
| 65 // This is the last position in the entire file (note: this equals | 65 // This is the last position in the entire file (note: this equals |
| 66 // file size of <debug-sourceinfo.js> - 1, since starting at 0). | 66 // file size of <debug-sourceinfo.js> - 1, since starting at 0). |
| 67 var last_position = 14072; | 67 var last_position = 14312; |
| 68 // This is the last line of entire file (note: starting at 0). | 68 // This is the last line of entire file (note: starting at 0). |
| 69 var last_line = 345; | 69 var last_line = 351; |
| 70 // This is the last column of last line (note: starting at 0 and +2, due | 70 // This is the last column of last line (note: starting at 0 and +2, due |
| 71 // to trailing <CR><LF>). | 71 // to trailing <CR><LF>). |
| 72 var last_column = 48; | 72 var last_column = 2; |
| 73 | 73 |
| 74 // This magic number is the length or the first line comment (actually number | 74 // This magic number is the length or the first line comment (actually number |
| 75 // of characters before 'function a(...'. | 75 // of characters before 'function a(...'. |
| 76 var comment_line_length = 1726; | 76 var comment_line_length = 1726; |
| 77 var start_a = 10 + comment_line_length; | 77 var start_a = 10 + comment_line_length; |
| 78 var start_b = 37 + comment_line_length; | 78 var start_b = 37 + comment_line_length; |
| 79 var start_c = 71 + comment_line_length; | 79 var start_c = 71 + comment_line_length; |
| 80 var start_d = 163 + comment_line_length; | 80 var start_d = 163 + comment_line_length; |
| 81 | 81 |
| 82 // The position of the first line of d(), i.e. "x = 1 ;". | 82 // The position of the first line of d(), i.e. "x = 1 ;". |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 location.restrict(5, 4); | 337 location.restrict(5, 4); |
| 338 assertEquals(' c(t', location.sourceText()); | 338 assertEquals(' c(t', location.sourceText()); |
| 339 | 339 |
| 340 location = script.locationFromLine(1, 0, start_b); | 340 location = script.locationFromLine(1, 0, start_b); |
| 341 location.restrict(7, 0); | 341 location.restrict(7, 0); |
| 342 assertEquals(' c(tru', location.sourceText()); | 342 assertEquals(' c(tru', location.sourceText()); |
| 343 | 343 |
| 344 location = script.locationFromLine(1, 0, start_b); | 344 location = script.locationFromLine(1, 0, start_b); |
| 345 location.restrict(7, 6); | 345 location.restrict(7, 6); |
| 346 assertEquals(' c(tru', location.sourceText()); | 346 assertEquals(' c(tru', location.sourceText()); |
| 347 |
| 348 // Test that script.sourceLine(line) works. |
| 349 for (line = 0; line < num_lines_d; line++) { |
| 350 var line_content_regexp = new RegExp(" x = " + (line + 1)); |
| 351 assertTrue(line_content_regexp.test(script.sourceLine(start_line_d + line))); |
| 352 } |
| OLD | NEW |