Index: test/mjsunit/debug-liveedit-compile-error.js |
diff --git a/test/mjsunit/debug-liveedit-1.js b/test/mjsunit/debug-liveedit-compile-error.js |
similarity index 76% |
copy from test/mjsunit/debug-liveedit-1.js |
copy to test/mjsunit/debug-liveedit-compile-error.js |
index 1ee7ce2a7cb19ee685ffd714db8ddc9b68d4519f..2fd6aedabf25abb9a1afda4db700fdf4061668aa 100644 |
--- a/test/mjsunit/debug-liveedit-1.js |
+++ b/test/mjsunit/debug-liveedit-compile-error.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2010 the V8 project authors. All rights reserved. |
+// Copyright 2012 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -30,9 +30,9 @@ |
Debug = debug.Debug |
-eval("var something1 = 25; " |
- + " function ChooseAnimal() { return 'Cat'; } " |
- + " ChooseAnimal.Helper = function() { return 'Help!'; }"); |
+eval("var something1 = 25; \n" |
+ + " function ChooseAnimal() { return 'Cat'; } \n" |
+ + " ChooseAnimal.Helper = function() { return 'Help!'; }\n"); |
assertEquals("Cat", ChooseAnimal()); |
@@ -40,9 +40,21 @@ var script = Debug.findScript(ChooseAnimal); |
var orig_animal = "Cat"; |
var patch_pos = script.source.indexOf(orig_animal); |
-var new_animal_patch = "Cap' + 'y' + 'bara"; |
+var new_animal_patch = "Cap' + ) + 'bara"; |
var change_log = new Array(); |
-Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, orig_animal.length, new_animal_patch, change_log); |
+var caught_exception = null; |
+try { |
+ Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, |
+ orig_animal.length, new_animal_patch, change_log); |
+} catch (e) { |
+ caught_exception = e; |
+} |
+ |
+assertNotNull(caught_exception); |
+assertEquals("Unexpected token )", |
+ caught_exception.details.syntaxErrorMessage); |
+ |
+assertEquals(2, caught_exception.details.position.start.line); |
+ |
-assertEquals("Capybara", ChooseAnimal()); |