예제 #1
0
        public void TestNegativeBlockComments(string content)
        {
            var input = new TextInputRange {
                File = new TextFile {
                    Content  = content,
                    Filename = ""
                }
            };

            var exception = Assert.Throws <Exception>(() => CommentScanner.Scan(input));

            Assert.True(exception.Message.Equals(value: "Line Comment not Escaped."));
        }
예제 #2
0
        public void TestNegativeLineComments(string content)
        {
            var input = new TextInputRange {
                File = new TextFile {
                    Content  = content,
                    Filename = ""
                }
            };

            var output = CommentScanner.Scan(input);

            Assert.IsFalse(output);
            Assert.AreEqual(content[index: 0], input.EndChar);
        }
예제 #3
0
        public void TestPositiveLineComments(string content)
        {
            var input = new TextInputRange {
                File = new TextFile {
                    Content  = content,
                    Filename = ""
                }
            };

            var output = CommentScanner.Scan(input);

            Assert.IsTrue(output);
            Assert.IsFalse(input.IsEndValid);
        }
예제 #4
0
        public void TestPositiveBlockComments(string content, int line)
        {
            var input = new TextInputRange {
                File = new TextFile {
                    Content  = content,
                    Filename = ""
                }
            };

            var output = CommentScanner.Scan(input);

            Assert.IsTrue(output);
            Assert.IsFalse(input.IsEndValid);
            Assert.AreEqual(line, input.End.Line);
        }
예제 #5
0
        public void TestNegativeLineEndLineComments(string content)
        {
            var input = new TextInputRange {
                File = new TextFile {
                    Content  = content,
                    Filename = ""
                }
            };

            var output = CommentScanner.Scan(input);

            Assert.IsTrue(output);
            Assert.IsTrue(input.IsEndValid);
            Assert.AreEqual(expected: '\n', actual: input.EndChar);
        }