Skip to content

Commit

Permalink
Add regression test for issue #1975
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfstr authored and marijnh committed Apr 24, 2024
1 parent 5a96634 commit fec380d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/comment_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})();

0 comments on commit fec380d

Please sign in to comment.