public void TestUnCommentCurrentLine() { var view = new MockTextView( new MockTextBuffer(@"//console.log('Hello'); //console.log('Goodbye');")); view.Caret.MoveTo(view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(0).Start); view.CommentOrUncommentBlock(false); Assert.AreEqual(@"console.log('Hello'); //console.log('Goodbye');", view.TextBuffer.CurrentSnapshot.GetText()); view.Caret.MoveTo(view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(1).Start); view.CommentOrUncommentBlock(false); Assert.AreEqual(@"console.log('Hello'); console.log('Goodbye');", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestUnCommentCurrentLine() { var view = new MockTextView( MockTextBuffer(@"#print 'hello' #print 'goodbye'")); view.Caret.MoveTo(view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(0).Start); view.CommentOrUncommentBlock(false); Assert.AreEqual(@"print 'hello' #print 'goodbye'", view.TextBuffer.CurrentSnapshot.GetText()); view.Caret.MoveTo(view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(1).Start); view.CommentOrUncommentBlock(false); Assert.AreEqual(@"print 'hello' print 'goodbye'", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestComment() { var view = new MockTextView( new MockTextBuffer(@"console.log('Hello'); console.log('Goodbye');")); view.Selection.Select( new SnapshotSpan(view.TextBuffer.CurrentSnapshot, new Span(0, view.TextBuffer.CurrentSnapshot.Length)), false ); view.CommentOrUncommentBlock(true); Assert.AreEqual(@"//console.log('Hello'); //console.log('Goodbye');", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestComment() { var view = new MockTextView( MockTextBuffer(@"print 'hello' print 'goodbye' ")); view.Selection.Select( new SnapshotSpan(view.TextBuffer.CurrentSnapshot, new Span(0, view.TextBuffer.CurrentSnapshot.Length)), false ); view.CommentOrUncommentBlock(true); Assert.AreEqual(@"#print 'hello' #print 'goodbye' ", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestCommentAfterCodeIsNotUncommented() { var view = new MockTextView( new MockTextBuffer(@"console.log('Hello');//comment that should stay a comment; //console.log('Still here');//another comment that should stay a comment; console.log('Goodbye');")); view.Selection.Select( new SnapshotSpan(view.TextBuffer.CurrentSnapshot, new Span(0, view.TextBuffer.CurrentSnapshot.GetText().IndexOf("console.log('Goodbye');"))), false ); view.CommentOrUncommentBlock(false); Assert.AreEqual(@"console.log('Hello');//comment that should stay a comment; console.log('Still here');//another comment that should stay a comment; console.log('Goodbye');", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestUnCommentIndented() { var view = new MockTextView( new MockTextBuffer(@"function f(){ //console.log('Hello'); //console.log('Still here'); console.log('Goodbye'); }")); view.Selection.Select( new SnapshotSpan( view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(1).Start, view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(2).End ), false ); view.CommentOrUncommentBlock(false); Assert.AreEqual(@"function f(){ console.log('Hello'); console.log('Still here'); console.log('Goodbye'); }", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestCommentBlankLine() { var view = new MockTextView( new MockTextBuffer(@"console.log('hi'); console.log('bye');")); view.Caret.MoveTo(view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(1).Start); view.CommentOrUncommentBlock(true); Assert.AreEqual(@"console.log('hi'); console.log('bye');", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestCommentAfterCodeIsNotUncommented() { var view = new MockTextView( MockTextBuffer(@"print 'hello' #comment that should stay a comment #print 'still here' # another comment that should stay a comment print 'goodbye'")); view.Selection.Select( new SnapshotSpan(view.TextBuffer.CurrentSnapshot, new Span(0, view.TextBuffer.CurrentSnapshot.GetText().IndexOf("print 'goodbye'"))), false ); view.CommentOrUncommentBlock(false); Assert.AreEqual(@"print 'hello' #comment that should stay a comment print 'still here' # another comment that should stay a comment print 'goodbye'", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestUnCommentIndented() { var view = new MockTextView( MockTextBuffer(@"def f(): #print 'hello' #print 'still here' print 'goodbye'")); view.Selection.Select( new SnapshotSpan( view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(1).Start, view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(2).End ), false ); view.CommentOrUncommentBlock(false); Assert.AreEqual(@"def f(): print 'hello' print 'still here' print 'goodbye'", view.TextBuffer.CurrentSnapshot.GetText()); }