示例#1
0
        public void MultiLineErrorPositionTest()
        {
            var lexer = Lexer.CreateState("/*/");

            _ = CommentScanner.ScanMultiLine(lexer, ref this.token);

            Assert.Equal(3, lexer.Src.Index);
        }
示例#2
0
        public void ScanMultiLineTrueTest()
        {
            var lexer = Lexer.CreateState("/**/");

            bool result = CommentScanner.ScanMultiLine(lexer, ref this.token);

            Assert.True(result);
        }
示例#3
0
        public void MultiLineNewLinePositionTest()
        {
            var lexer = Lexer.CreateState("/*" + Environment.NewLine + "*/");

            _ = CommentScanner.ScanMultiLine(lexer, ref this.token);

            Assert.Equal(5, lexer.Src.Index);
        }
示例#4
0
        public void ScanMultiLineFalseTest()
        {
            foreach (string text in new[] { "/*/", "/**", "/*" })
            {
                var lexer = Lexer.CreateState(text);

                bool result = CommentScanner.ScanMultiLine(lexer, ref this.token);

                Assert.False(result);
            }
        }
示例#5
0
        public void ScanMultiLineNewLineTest()
        {
            string comment = "/*" + Environment.NewLine + "*/";

            var lexer = Lexer.CreateState(comment);

            bool result = CommentScanner.ScanMultiLine(lexer, ref this.token);

            Assert.True(result);

            Assert.Equal(comment, this.token.Value);
        }