Skip to content

Commit fec380d

Browse files
davidfstrmarijnh
authored andcommitted
Add regression test for issue #1975
1 parent 5a96634 commit fec380d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/comment_test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,16 @@ namespace = "comment_";
120120
cm.execCommand("selectAll")
121121
cm.execCommand("toggleComment")
122122
}, "/* foo */\na\n/* bar */\nb", "// /* foo */\n// a\n// /* bar */\n// b")
123+
124+
var before = 'console.log("//string gets corrupted.");';
125+
var after = '// console.log("//string gets corrupted.");';
126+
test("toggleWithStringContainingComment1", "javascript", function(cm) {
127+
cm.setCursor({line: 0, ch: 16 /* after // inside string */});
128+
cm.execCommand("toggleComment");
129+
}, before, after)
130+
test("toggleWithStringContainingComment2", "javascript", function(cm) {
131+
cm.setCursor({line: 0, ch: 16 /* after // inside string */});
132+
cm.execCommand("toggleComment");
133+
cm.execCommand("toggleComment");
134+
}, before, before)
123135
})();

0 commit comments

Comments
 (0)