Tests/src/ErrorFile.cs
/// <summary>
/// Checks that the compilation of a file produces the expected errors
/// </summary>
/// <param name="fileNames">The names of the files</param>
/// <param name="fromError">The number from the error to check that match with the expected ones.</param>
/// <param name="toError">The number to the error to check that match with the expected ones.</param>
/// <param name="expectedErrors">Output parameter: The number of expected errors.</param>
/// <returns>True if the expected errors where found</returns>
Checks that the compilation of a file produces the expected errors
Checks that the compilation of a file produces the expected errors
public static bool CheckErrors(string[] fileNames, int fromError, int toError, out int expectedErrors) {
            expectedErrors = 0;
            IDictionary<string, string> directories = new Dictionary<string, string>();
            foreach (string fileName in fileNames)
                GetDirectories(fileName, directories);
            IList<string> errorDescriptionFileNames = new List<string>();
            foreach (KeyValuePair<string, string> pair in directories) {
                string errorDescriptionFileName = Path.ChangeExtension(pair.Value + "\\" + pair.Key, ".txt");
                if (File.Exists(errorDescriptionFileName))
                    errorDescriptionFileNames.Add(errorDescriptionFileName);
            }
            IList<ErrorDescription> expectedErrorList = ExpectedErrors(errorDescriptionFileNames);
            return CheckMatch(expectedErrorList, fromError, toError, out expectedErrors);
        }
public static bool CheckErrors ( string [ ] fileNames , int fromError , int toError , out int expectedErrors ) { expectedErrors = 0 ; IDictionary < string , string > directories = new Dictionary < string , string > ( ) ; foreach ( string fileName in fileNames ) GetDirectories ( fileName , directories ) ; IList < string > errorDescriptionFileNames = new List < string > ( ) ; foreach ( KeyValuePair < string , string > pair in directories ) { string errorDescriptionFileName = Path . ChangeExtension ( pair . Value + " \\ " + pair . Key , " " ) ; if ( File . Exists ( errorDescriptionFileName ) ) errorDescriptionFileNames . Add ( errorDescriptionFileName ) ; } IList < ErrorDescription > expectedErrorList = ExpectedErrors ( errorDescriptionFileNames ) ; return CheckMatch ( expectedErrorList , fromError , toError , out expectedErrors ) ; }
Checks that the compilation of a file produces the expected errors
Checks that the compilation of a file produces the expected errors
// * Gets the file names with the directories // * Gets the text error description files // * Takes the expected errors // * Checks that both lists match
True if the expected errors where found
True if the expected errors where found
fileNames
string[]
The names of the files
The names of the files
fromError
int
The number from the error to check that match with the expected ones.
The number from the error to check that match with the expected ones .
toError
int
The number to the error to check that match with the expected ones.
The number to the error to check that match with the expected ones .
int
out
expectedErrors
Output parameter: The number of expected errors.
Output parameter : The number of expected errors .