示例#1
0
        public void SinleLinedMultilineBlockCanReadAllLines()
        {
            var text = " /* line one */ ";

            var parts = CommentTextExtractor.LocateMultiLineCommentTextParts(text);

            parts.Should().HaveCount(1);
            parts.Single().Start.Should().Be(4);
            parts.Single().Length.Should().Be(8);
        }
示例#2
0
        public void TightMultilineBlockCanReadAllLines()
        {
            var text = "/* line one\n   line two\n   line three */";

            var parts = CommentTextExtractor.LocateMultiLineCommentTextParts(text).ToList();

            parts.Should().HaveCount(3);
            parts[0].Start.Should().Be(3);
            parts[0].Length.Should().Be(8);
            parts[1].Start.Should().Be(15);
            parts[1].Length.Should().Be(8);
            parts[2].Start.Should().Be(27);
            parts[2].Length.Should().Be(10);
        }
示例#3
0
        public void CanExtractMultilineParts()
        {
            var text = "    /*\r\n     * Words words words.\r\n     * This is aardvark.\r\n\r\n   * \r\n     * <code> \r     * Console.WriteLine(\"code\");\r\n     * </code>\r\n     */";

            var parts = CommentTextExtractor.LocateMultiLineCommentTextParts(text).ToList();
            var debug = parts.Select(span => text.Substring(span.Start, span.Length)).ToList();

            parts.Should().HaveCount(5);
            parts[0].Start.Should().Be(15);
            parts[0].Length.Should().Be(18);
            parts[1].Start.Should().Be(42);
            parts[1].Length.Should().Be(17);
            parts[2].Start.Should().Be(77);
            parts[2].Length.Should().Be(6);
            parts[3].Start.Should().Be(92);
            parts[3].Length.Should().Be(26);
            parts[4].Start.Should().Be(127);
            parts[4].Length.Should().Be(7);
        }