Esempio n. 1
0
        public void OverflowTrimmingShouldNotDropChar()
        {
            // A devdiv build produced a huge message like this!
            string message = @"The name 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' does not exist in the current context";
            string error   = @"test.cs(1,32): error CS0103: " + message;

            CanonicalError.Parts parts = CanonicalError.Parse(error);

            Helpers.VerifyAssertLineByLine(message, parts.text);
        }
Esempio n. 2
0
        private static void ValidateFileNameMultiLineColumnError(string message, string filename, int line, int column, int endLine, int endColumn, CanonicalError.Parts.Category severity, string code, string text)
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(message);

            Assert.IsNotNull(errorParts, "The message '" + message + "' could not be interpretted.");
            AssertEqual(errorParts.origin, filename);
            AssertEqual(errorParts.category, severity);
            AssertEqual(errorParts.code, code);
            AssertEqual(errorParts.text, text);
            AssertEqual(errorParts.line, line);
            AssertEqual(errorParts.column, column);
            AssertEqual(errorParts.endLine, endLine);
            AssertEqual(errorParts.endColumn, endColumn);
        }
Esempio n. 3
0
        private static void ValidateToolError(string message, string tool, CanonicalError.Parts.Category severity, string code, string text)
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(message);

            Assert.IsNotNull(errorParts, "The message '" + message + "' could not be interpretted.");
            AssertEqual(errorParts.origin, tool);
            AssertEqual(errorParts.category, severity);
            AssertEqual(errorParts.code, code);
            AssertEqual(errorParts.text, text);
            AssertEqual(errorParts.line, CanonicalError.Parts.numberNotSpecified);
            AssertEqual(errorParts.column, CanonicalError.Parts.numberNotSpecified);
            AssertEqual(errorParts.endLine, CanonicalError.Parts.numberNotSpecified);
            AssertEqual(errorParts.endColumn, CanonicalError.Parts.numberNotSpecified);
        }
Esempio n. 4
0
        private static void ValidateFileNameMultiLineColumnError(string message, string filename, int line, int column, int endLine, int endColumn, CanonicalError.Parts.Category severity, string code, string text)
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(message);

            errorParts.ShouldNotBeNull(); // "The message '" + message + "' could not be interpreted."
            errorParts.origin.ShouldBe(filename);
            errorParts.category.ShouldBe(severity);
            errorParts.code.ShouldBe(code);
            errorParts.text.ShouldBe(text);
            errorParts.line.ShouldBe(line);
            errorParts.column.ShouldBe(column);
            errorParts.endLine.ShouldBe(endLine);
            errorParts.endColumn.ShouldBe(endColumn);
        }
Esempio n. 5
0
        private static void ValidateToolError(string message, string tool, CanonicalError.Parts.Category severity, string code, string text)
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(message);

            errorParts.ShouldNotBeNull(); // "The message '" + message + "' could not be interpreted."
            errorParts.origin.ShouldBe(tool);
            errorParts.category.ShouldBe(severity);
            errorParts.code.ShouldBe(code);
            errorParts.text.ShouldBe(text);
            errorParts.line.ShouldBe(CanonicalError.Parts.numberNotSpecified);
            errorParts.column.ShouldBe(CanonicalError.Parts.numberNotSpecified);
            errorParts.endLine.ShouldBe(CanonicalError.Parts.numberNotSpecified);
            errorParts.endColumn.ShouldBe(CanonicalError.Parts.numberNotSpecified);
        }
Esempio n. 6
0
        public void ClangGccError()
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(
                "err.cpp:6:3: error: use of undeclared identifier 'force_an_error'");

            errorParts.ShouldNotBeNull();
            errorParts.origin.ShouldBe("err.cpp");
            errorParts.category.ShouldBe(CanonicalError.Parts.Category.Error);
            errorParts.code.ShouldStartWith("G");
            errorParts.code.Length.ShouldBe(9);
            errorParts.text.ShouldBe("use of undeclared identifier 'force_an_error'");
            errorParts.line.ShouldBe(6);
            errorParts.column.ShouldBe(3);
            errorParts.endLine.ShouldBe(CanonicalError.Parts.numberNotSpecified);
            errorParts.endColumn.ShouldBe(CanonicalError.Parts.numberNotSpecified);
        }
Esempio n. 7
0
        public void ClangGccError()
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(
                "err.cpp:6:3: error: use of undeclared identifier 'force_an_error'");

            Assert.NotNull(errorParts);
            AssertEqual(errorParts.origin, "err.cpp");
            AssertEqual(errorParts.category, CanonicalError.Parts.Category.Error);
            Assert.StartsWith("G", errorParts.code);
            AssertEqual(errorParts.code.Length, 9);
            AssertEqual(errorParts.text, "use of undeclared identifier 'force_an_error'");
            AssertEqual(errorParts.line, 6);
            AssertEqual(errorParts.column, 3);
            AssertEqual(errorParts.endLine, CanonicalError.Parts.numberNotSpecified);
            AssertEqual(errorParts.endColumn, CanonicalError.Parts.numberNotSpecified);
        }
Esempio n. 8
0
        private static void ValidateNormalMessage(string message)
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(message);

            Assert.IsNull(errorParts, "The message '" + message + "' is an error/warning message");
        }
Esempio n. 9
0
        private static void ValidateNormalMessage(string message)
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(message);

            errorParts.ShouldBeNull(); // "The message '" + message + "' is an error/warning message"
        }
Esempio n. 10
0
 private static void ValidateFileNameError(string message, string filename, CanonicalError.Parts.Category severity, string code, string text)
 {
     ValidateFileNameMultiLineColumnError(message, filename, CanonicalError.Parts.numberNotSpecified, CanonicalError.Parts.numberNotSpecified, CanonicalError.Parts.numberNotSpecified, CanonicalError.Parts.numberNotSpecified, severity, code, text);
 }
Esempio n. 11
0
        private static void ValidateFileNameMultiLineColumnError(string message, string filename, int line, int column, int endLine, int endColumn, CanonicalError.Parts.Category severity, string code, string text)
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(message);

            Assert.NotNull(errorParts); // "The message '" + message + "' could not be interpretted."
            AssertEqual(errorParts.origin, filename);
            AssertEqual(errorParts.category, severity);
            AssertEqual(errorParts.code, code);
            AssertEqual(errorParts.text, text);
            AssertEqual(errorParts.line, line);
            AssertEqual(errorParts.column, column);
            AssertEqual(errorParts.endLine, endLine);
            AssertEqual(errorParts.endColumn, endColumn);
        }
Esempio n. 12
0
        private static void ValidateToolError(string message, string tool, CanonicalError.Parts.Category severity, string code, string text)
        {
            CanonicalError.Parts errorParts = CanonicalError.Parse(message);

            Assert.NotNull(errorParts); // "The message '" + message + "' could not be interpretted."
            AssertEqual(errorParts.origin, tool);
            AssertEqual(errorParts.category, severity);
            AssertEqual(errorParts.code, code);
            AssertEqual(errorParts.text, text);
            AssertEqual(errorParts.line, CanonicalError.Parts.numberNotSpecified);
            AssertEqual(errorParts.column, CanonicalError.Parts.numberNotSpecified);
            AssertEqual(errorParts.endLine, CanonicalError.Parts.numberNotSpecified);
            AssertEqual(errorParts.endColumn, CanonicalError.Parts.numberNotSpecified);
        }
Esempio n. 13
0
        private static void AssertEqual(CanonicalError.Parts.Category cat1, CanonicalError.Parts.Category cat2)
        {
            if (cat1 != cat2)
            {
                string message = "Regression: category compare '" + cat1.ToString() + "'!='" + cat2.ToString() + "'";

                Assert.Equal(cat1, cat2);
            }
        }