public void LineCommentInfo_LeadingEightSpaceTabIsEightSpaces() { var snapshot = new SimpleSnapshot( "\t// this is a comment"); var eightSpaceTab = new SimpleEditorOptions(); eightSpaceTab.Parent = this.defaultOptions; eightSpaceTab.SetOptionValue("Tabs/TabSize", 8); var info = LineCommentInfo.FromLine( snapshot.GetLineFromLineNumber(0), eightSpaceTab, this.wholeLineCommentClassifier); Assert.IsNotNull(info); Assert.IsTrue(info.CommentOnly); Assert.AreEqual(1, info.CommentSpan.Start.Position); Assert.AreEqual(1, info.MarkerSpan.Start.Position); Assert.AreEqual(8, info.MarkerColumnStart); Assert.AreEqual(4, info.ContentSpan.Start.Position); Assert.AreEqual(11, info.ContentColumnStart); }
public void LineCommentInfo_LeadingTabIsFourSpaces() { var snapshot = new SimpleSnapshot( "\t// this is a comment"); var info = LineCommentInfo.FromLine( snapshot.GetLineFromLineNumber(0), this.defaultOptions, this.wholeLineCommentClassifier); Assert.IsNotNull(info); Assert.IsTrue(info.CommentOnly); Assert.AreEqual(1, info.CommentSpan.Start.Position); Assert.AreEqual(1, info.MarkerSpan.Start.Position); Assert.AreEqual(4, info.MarkerColumnStart); Assert.AreEqual(4, info.ContentSpan.Start.Position); Assert.AreEqual(7, info.ContentColumnStart); }
public void LineCommentInfo_SimpleSingleLineCommentsMatch() { var snapshot = new SimpleSnapshot( "// this is a comment", "// that continues to a second line"); var info0 = LineCommentInfo.FromLine( snapshot.GetLineFromLineNumber(0), this.defaultOptions, this.wholeLineCommentClassifier); var info1 = LineCommentInfo.FromLine( snapshot.GetLineFromLineNumber(1), this.defaultOptions, this.wholeLineCommentClassifier); Assert.IsNotNull(info0); Assert.IsNotNull(info1); Assert.IsTrue(info0.Matches(info1)); }
public void LineCommentInfo_SimpleSingleLineComment() { var snapshot = new SimpleSnapshot( "// this is a comment"); var info = LineCommentInfo.FromLine( snapshot.GetLineFromLineNumber(0), this.defaultOptions, this.wholeLineCommentClassifier); Assert.IsNotNull(info); Assert.IsTrue(info.CommentOnly); Assert.AreEqual(info.Line.Extent, info.CommentSpan); Assert.AreEqual(0, info.MarkerSpan.Start.Position); Assert.AreEqual(2, info.MarkerSpan.End.Position); Assert.AreEqual(2, info.MarkerSpan.Length); Assert.AreEqual(0, info.MarkerColumnStart); Assert.AreEqual(CommentStyle.SingleLine, info.Style); Assert.AreEqual(3, info.ContentSpan.Start.Position); Assert.AreEqual(3, info.ContentColumnStart); Assert.AreEqual(info.Line.End.Position, info.ContentSpan.End.Position); }