Example #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."));
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }