From fec380ddc125419ab2ba47765442ea557a88d611 Mon Sep 17 00:00:00 2001 From: David Foster Date: Mon, 22 Apr 2024 12:46:40 -0700 Subject: [PATCH] Add regression test for issue #1975 --- test/comment_test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/comment_test.js b/test/comment_test.js index 2210667163..7612f47e37 100644 --- a/test/comment_test.js +++ b/test/comment_test.js @@ -120,4 +120,16 @@ namespace = "comment_"; cm.execCommand("selectAll") cm.execCommand("toggleComment") }, "/* foo */\na\n/* bar */\nb", "// /* foo */\n// a\n// /* bar */\n// b") + + var before = 'console.log("//string gets corrupted.");'; + var after = '// console.log("//string gets corrupted.");'; + test("toggleWithStringContainingComment1", "javascript", function(cm) { + cm.setCursor({line: 0, ch: 16 /* after // inside string */}); + cm.execCommand("toggleComment"); + }, before, after) + test("toggleWithStringContainingComment2", "javascript", function(cm) { + cm.setCursor({line: 0, ch: 16 /* after // inside string */}); + cm.execCommand("toggleComment"); + cm.execCommand("toggleComment"); + }, before, before) })();