pascalabcnet/bin/TestRunner.pas

475 lines
16 KiB
ObjectPascal
Raw Permalink Normal View History

// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
2015-06-12 21:59:28 +03:00
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
2015-05-14 22:35:07 +03:00
{$reference Compiler.dll}
{$reference CodeCompletion.dll}
{$reference Errors.dll}
{$reference CompilerTools.dll}
2016-05-06 14:56:19 +03:00
{$reference Localization.dll}
2015-05-14 22:35:07 +03:00
{$reference System.Windows.Forms.dll}
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
{$reference LanguageIntegrator.dll}
2015-05-14 22:35:07 +03:00
uses PascalABCCompiler, System.IO, System.Diagnostics;
2018-06-03 20:49:55 +03:00
var
TestSuiteDir: string;
2021-01-05 14:32:21 +03:00
nogui: boolean;
2018-06-03 20:49:55 +03:00
var
PathSeparator: string := Path.DirectorySeparatorChar;
2015-05-14 22:35:07 +03:00
function IsUnix: boolean;
begin
Result := (System.Environment.OSVersion.Platform = System.PlatformID.Unix) or (System.Environment.OSVersion.Platform = System.PlatformID.MacOSX);
end;
2015-05-14 22:35:07 +03:00
function GetTestSuiteDir: string;
begin
var dir := Path.GetDirectoryName(GetEXEFileName());
var ind := dir.LastIndexOf('bin');
2018-06-03 20:49:55 +03:00
Result := dir.Substring(0, ind) + 'TestSuite';
2015-05-14 22:35:07 +03:00
end;
function GetLibDir: string;
begin
var dir := Path.GetDirectoryName(GetEXEFileName());
2018-06-03 20:49:55 +03:00
Result := dir + PathSeparator + 'Lib';
2015-05-14 22:35:07 +03:00
end;
procedure CompileErrorTests(withide: boolean);
begin
2021-10-31 15:48:32 +03:00
2015-05-14 22:35:07 +03:00
2018-06-03 20:49:55 +03:00
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'errors', '*.pas');
2015-05-14 22:35:07 +03:00
for var i := 0 to files.Length - 1 do
begin
2021-10-31 15:48:32 +03:00
var comp := new Compiler();
var content := &File.ReadAllText(files[i]);
if content.StartsWith('//winonly') and IsUnix then
continue;
2021-10-17 13:04:24 +03:00
if content.StartsWith('//exclude') then
continue;
var errorMessage := '';
if content.StartsWith('//!') then
begin
errorMessage := content.Substring(3, content.IndexOf(System.Environment.NewLine)-3).Trim;
end;
2018-06-03 20:49:55 +03:00
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
2015-05-14 22:35:07 +03:00
co.Debug := true;
2018-06-03 20:49:55 +03:00
co.OutputDirectory := TestSuiteDir + PathSeparator + 'errors';
2015-05-14 22:35:07 +03:00
co.UseDllForSystemUnits := false;
co.RunWithEnvironment := withide;
comp.ErrorsList.Clear();
comp.Warnings.Clear();
comp.Compile(co);
if comp.ErrorsList.Count = 0 then
begin
2021-01-05 14:32:21 +03:00
if nogui then
raise new Exception('Compilation of error sample ' + files[i] + ' was successfull');
2018-06-03 20:49:55 +03:00
System.Windows.Forms.MessageBox.Show('Compilation of error sample ' + files[i] + ' was successfull' + System.Environment.NewLine);
2016-05-15 22:01:40 +03:00
Halt();
2015-05-14 22:35:07 +03:00
end
else if comp.ErrorsList.Count = 1 then
begin
if comp.ErrorsList[0].GetType() = typeof(PascalABCCompiler.Errors.CompilerInternalError) then
2021-01-05 14:32:21 +03:00
begin
if nogui then
raise new Exception('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2018-06-03 20:49:55 +03:00
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2021-01-05 14:32:21 +03:00
end;
2021-10-31 15:48:32 +03:00
if (errorMessage <> '') and (comp.ErrorsList[comp.ErrorsList.Count-1].Message.Trim <> errorMessage) then
2021-10-17 13:04:24 +03:00
begin
2021-10-31 15:48:32 +03:00
if nogui then
raise new Exception('Wrong error message in file ' + files[i] + ', should '+errorMessage+', is '+comp.ErrorsList[comp.ErrorsList.Count-1].Message);
System.Windows.Forms.MessageBox.Show('Wrong error message in file ' + files[i] + ', should '+errorMessage+', is '+comp.ErrorsList[comp.ErrorsList.Count-1].Message);
2021-10-17 13:04:24 +03:00
end;
2015-05-14 22:35:07 +03:00
end;
if i mod 50 = 0 then
2018-01-30 22:39:20 +03:00
System.GC.Collect();
2015-05-14 22:35:07 +03:00
end;
end;
procedure CompileAllRunTests(withdll: boolean; only32bit: boolean := false);
begin
var comp := new Compiler();
2018-06-03 20:49:55 +03:00
var files := Directory.GetFiles(TestSuiteDir, '*.pas');
2015-05-14 22:35:07 +03:00
for var i := 0 to files.Length - 1 do
begin
2021-04-18 18:40:56 +03:00
if IsUnix then
writeln('Compile file '+files[i]);
var content := &File.ReadAllText(files[i]);
if content.StartsWith('//winonly') and IsUnix then
continue;
2019-06-30 15:22:24 +03:00
if content.StartsWith('//nopabcrtl') and withdll then
continue;
2018-06-03 20:49:55 +03:00
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
2015-05-14 22:35:07 +03:00
co.Debug := true;
2018-06-03 20:49:55 +03:00
co.OutputDirectory := TestSuiteDir + PathSeparator + 'exe';
2023-08-14 00:17:35 +03:00
Directory.CreateDirectory(co.OutputDirectory);
2015-05-14 22:35:07 +03:00
co.UseDllForSystemUnits := withdll;
co.RunWithEnvironment := false;
co.IgnoreRtlErrors := false;
co.Only32Bit := only32bit;
comp.ErrorsList.Clear();
comp.Warnings.Clear();
comp.Compile(co);
if comp.ErrorsList.Count > 0 then
begin
2021-01-05 14:32:21 +03:00
if nogui then
raise new Exception('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2018-06-03 20:49:55 +03:00
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2018-05-13 15:19:54 +03:00
Halt();
2015-05-14 22:35:07 +03:00
end;
2024-01-04 17:32:19 +03:00
if content.StartsWith('//!') then
begin
var warning := content.Substring(3, content.IndexOf(System.Environment.NewLine)-3).Trim;
if comp.Warnings.Count = 0 then
begin
if nogui then
raise new Exception('Missing warning in '+files[i]);
System.Windows.Forms.MessageBox.Show('Missing warning in '+files[i]);
Halt();
end;
if comp.Warnings[0].Message <> warning then
begin
if nogui then
raise new Exception('Wrong warning for '+files[i]+': '+comp.Warnings[0].Message);
System.Windows.Forms.MessageBox.Show('Wrong warning for '+files[i]+': '+comp.Warnings[0].Message);
Halt();
end;
end;
if i mod 50 = 0 then
begin
2018-01-30 22:39:20 +03:00
System.GC.Collect();
end;
2015-05-14 22:35:07 +03:00
end;
2018-05-20 15:18:29 +03:00
//Println;
2015-05-14 22:35:07 +03:00
end;
procedure CompileAllCompilationTests(dir: string; withdll: boolean);
begin
var comp := new Compiler();
2018-06-03 20:49:55 +03:00
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + dir, '*.pas');
2015-05-14 22:35:07 +03:00
for var i := 0 to files.Length - 1 do
begin
var content := &File.ReadAllText(files[i]);
if content.StartsWith('//winonly') and IsUnix then
continue;
2018-06-03 20:49:55 +03:00
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
2015-05-14 22:35:07 +03:00
co.Debug := true;
2018-06-03 20:49:55 +03:00
co.OutputDirectory := TestSuiteDir + PathSeparator + dir;
2015-05-14 22:35:07 +03:00
co.UseDllForSystemUnits := withdll;
co.RunWithEnvironment := false;
co.IgnoreRtlErrors := false;
comp.ErrorsList.Clear();
comp.Warnings.Clear();
comp.Compile(co);
if comp.ErrorsList.Count > 0 then
begin
2021-01-05 14:32:21 +03:00
if nogui then
raise new Exception('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2018-06-03 20:49:55 +03:00
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2015-05-14 22:35:07 +03:00
Halt();
end;
if i mod 50 = 0 then
2018-01-30 22:39:20 +03:00
System.GC.Collect();
2015-05-14 22:35:07 +03:00
end;
end;
procedure CompileAllUnits;
begin
var comp := new Compiler();
2018-06-03 20:49:55 +03:00
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'units', '*.pas');
var dir := TestSuiteDir + PathSeparator + 'units' + PathSeparator;
2015-05-14 22:35:07 +03:00
for var i := 0 to files.Length - 1 do
begin
var content := &File.ReadAllText(files[i]);
if content.StartsWith('//winonly') and IsUnix then
continue;
2018-06-03 20:49:55 +03:00
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
2015-05-14 22:35:07 +03:00
co.Debug := true;
co.OutputDirectory := dir;
co.UseDllForSystemUnits := false;
comp.ErrorsList.Clear();
comp.Warnings.Clear();
comp.Compile(co);
if comp.ErrorsList.Count > 0 then
begin
2021-01-05 14:32:21 +03:00
if nogui then
raise new Exception('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2018-06-03 20:49:55 +03:00
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2015-05-14 22:35:07 +03:00
Halt();
end;
end;
2018-01-30 22:39:20 +03:00
System.GC.Collect;
2015-05-14 22:35:07 +03:00
end;
procedure CompileAllUsesUnits;
begin
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
var comp := new Compiler();
2018-06-03 20:49:55 +03:00
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'usesunits', '*.pas');
2015-05-14 22:35:07 +03:00
for var i := 0 to files.Length - 1 do
begin
var content := &File.ReadAllText(files[i]);
if content.StartsWith('//winonly') and IsUnix then
continue;
2018-06-03 20:49:55 +03:00
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
2015-05-14 22:35:07 +03:00
co.Debug := true;
2018-06-03 20:49:55 +03:00
co.OutputDirectory := TestSuiteDir + PathSeparator + 'exe';
2015-05-14 22:35:07 +03:00
co.UseDllForSystemUnits := false;
comp.ErrorsList.Clear();
comp.Warnings.Clear();
comp.Compile(co);
if comp.ErrorsList.Count > 0 then
begin
2021-01-05 14:32:21 +03:00
if nogui then
raise new Exception('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2018-06-03 20:49:55 +03:00
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
2015-05-14 22:35:07 +03:00
Halt();
end;
end;
2018-01-30 22:39:20 +03:00
System.GC.Collect;
2015-05-14 22:35:07 +03:00
end;
procedure CopyPCUFiles;
begin
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
2018-06-03 20:49:55 +03:00
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'units', '*.pcu');
2015-05-14 22:35:07 +03:00
foreach fname: string in files do
begin
2018-06-03 20:49:55 +03:00
&File.Move(fname, TestSuiteDir + PathSeparator + 'usesunits' + PathSeparator + Path.GetFileName(fname));
2015-05-14 22:35:07 +03:00
end;
end;
procedure RunAllTests(redirectIO: boolean);
begin
2020-12-26 20:05:31 +03:00
var dlls := Directory.GetFiles(TestSuiteDir, '*.dll');
foreach var dll in dlls do
begin
System.IO.File.Copy(dll, TestSuiteDir + PathSeparator + 'exe' + PathSeparator + Path.GetFileName(dll), true);
end;
2018-06-03 20:49:55 +03:00
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'exe', '*.exe');
2015-05-14 22:35:07 +03:00
for var i := 0 to files.Length - 1 do
begin
//Println(files[i]);
2018-06-03 20:49:55 +03:00
var psi := new System.Diagnostics.ProcessStartInfo(files[i]);
psi.CreateNoWindow := true;
psi.UseShellExecute := false;
psi.WorkingDirectory := TestSuiteDir + PathSeparator + 'exe';
2015-05-14 22:35:07 +03:00
{psi.RedirectStandardInput := true;
psi.RedirectStandardOutput := true;
psi.RedirectStandardError := true;}
2018-06-03 20:49:55 +03:00
var p: Process := new Process();
p.StartInfo := psi;
p.Start();
if redirectIO then
p.StandardInput.WriteLine('GO');
2015-05-14 22:35:07 +03:00
//p.StandardInput.AutoFlush := true;
//var p := System.Diagnostics.Process.Start(psi);
2021-01-05 15:50:31 +03:00
if nogui then
begin
var success := p.WaitForExit(60000);
if not success then
begin
raise new Exception('Running of ' + files[i] + ' failed.');
end;
end
else
p.WaitForExit();
2021-01-02 16:49:05 +03:00
//while not p.HasExited do
// Sleep(5);
2018-06-03 20:49:55 +03:00
if p.ExitCode <> 0 then
begin
2021-01-05 14:32:21 +03:00
if nogui then
raise new Exception('Running of ' + files[i] + ' failed. Exit code is not 0');
2018-06-03 20:49:55 +03:00
System.Windows.Forms.MessageBox.Show('Running of ' + files[i] + ' failed. Exit code is not 0');
Halt;
end;
2015-05-14 22:35:07 +03:00
end;
end;
procedure RunExpressionsExtractTests;
begin
CodeCompletion.CodeCompletionTester.Test();
end;
2016-05-06 14:56:19 +03:00
function GetLineByPos(lines: array of string; pos: integer): integer;
begin
var cum_pos := 0;
for var i := 0 to lines.Length - 1 do
2018-06-03 20:49:55 +03:00
for var j := 0 to lines[j].Length - 1 do
2016-05-06 14:56:19 +03:00
begin
2018-06-03 20:49:55 +03:00
if cum_pos = pos then
begin
Result := i + 1;
exit;
end;
Inc(cum_pos);
2016-05-06 14:56:19 +03:00
end;
end;
function GetColByPos(lines: array of string; pos: integer): integer;
begin
var cum_pos := 0;
for var i := 0 to lines.Length - 1 do
2018-06-03 20:49:55 +03:00
for var j := 0 to lines[j].Length - 1 do
2016-05-06 14:56:19 +03:00
begin
2018-06-03 20:49:55 +03:00
if cum_pos = pos then
begin
Result := j + 1;
exit;
end;
Inc(cum_pos);
2016-05-06 14:56:19 +03:00
end;
end;
procedure RunIntellisenseTests;
begin
PascalABCCompiler.StringResourcesLanguage.CurrentTwoLetterISO := 'ru';
2018-06-03 20:49:55 +03:00
CodeCompletion.CodeCompletionTester.TestIntellisense(TestSuiteDir + PathSeparator + 'intellisense_tests');
2016-05-06 14:56:19 +03:00
end;
2015-05-14 22:35:07 +03:00
procedure RunFormatterTests;
begin
CodeCompletion.FormatterTester.Test();
2018-06-03 20:49:55 +03:00
var errors := &File.ReadAllText(TestSuiteDir + PathSeparator + 'formatter_tests' + PathSeparator + 'output' + PathSeparator + 'log.txt');
2015-05-14 22:35:07 +03:00
if not string.IsNullOrEmpty(errors) then
begin
2018-06-03 20:49:55 +03:00
System.Windows.Forms.MessageBox.Show(errors + System.Environment.NewLine + 'more info at TestSuite/formatter_tests/output/log.txt');
2015-05-14 22:35:07 +03:00
Halt;
end;
end;
procedure ClearDirByPattern(dir, pattern: string);
begin
2023-08-14 00:17:35 +03:00
if not Directory.Exists(dir) then exit;
2015-05-14 22:35:07 +03:00
var files := Directory.GetFiles(dir, pattern);
for var i := 0 to files.Length - 1 do
begin
try
2015-05-15 12:35:40 +03:00
if Path.GetFileName(files[i]) <> '.gitignore' then
&File.Delete(files[i]);
2015-05-14 22:35:07 +03:00
except
end;
end;
end;
procedure ClearExeDir;
begin
2018-06-03 20:49:55 +03:00
ClearDirByPattern(TestSuiteDir + PathSeparator + 'exe', '*.*');
ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.exe');
ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.mdb');
ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.pdb');
ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.pcu');
ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.exe');
ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.pdb');
ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.mdb');
ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.pcu');
2015-05-14 22:35:07 +03:00
end;
procedure DeletePCUFiles;
begin
2018-06-03 20:49:55 +03:00
ClearDirByPattern(TestSuiteDir + PathSeparator + 'usesunits', '*.pcu');
2015-05-14 22:35:07 +03:00
end;
procedure DeletePABCSystemPCU;
begin
2018-06-03 20:49:55 +03:00
var dir := Path.Combine(Path.GetDirectoryName(GetEXEFileName()), 'Lib');
var pcu := Path.Combine(dir, 'PABCSystem.pcu');
2015-05-14 22:35:07 +03:00
end;
procedure CopyLibFiles;
begin
2018-06-03 20:49:55 +03:00
var files := Directory.GetFiles(GetLibDir(), '*.pas');
2015-05-14 22:35:07 +03:00
foreach f: string in files do
begin
2018-06-03 20:49:55 +03:00
&File.Copy(f, TestSuiteDir + PathSeparator + 'CompilationSamples' + PathSeparator + Path.GetFileName(f), true);
2015-05-14 22:35:07 +03:00
end;
end;
begin
//DeletePABCSystemPCU;
try
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
Languages.Integration.LanguageIntegrator.LoadStandardLanguages();
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
TestSuiteDir := GetTestSuiteDir;
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
2021-01-05 14:32:21 +03:00
if (ParamCount = 2) and (ParamStr(2) = '1') then
nogui := true;
2018-06-03 20:49:55 +03:00
if (ParamCount = 0) or (ParamStr(1) = '1') then
begin
DeletePCUFiles;
ClearExeDir;
CompileAllRunTests(false);
2021-01-02 16:49:05 +03:00
writeln('Tests to run: '+Milliseconds()+'ms');
2018-06-03 20:49:55 +03:00
end;
if (ParamCount = 0) or (ParamStr(1) = '2') then
begin
CopyLibFiles;
CompileAllCompilationTests('CompilationSamples', false);
2021-01-02 16:49:05 +03:00
writeln('CompilationSamples: '+Milliseconds()+'ms');
2018-06-03 20:49:55 +03:00
end;
if (ParamCount = 0) or (ParamStr(1) = '3') then
begin
CompileAllUnits;
CopyPCUFiles;
CompileAllUsesUnits;
CompileErrorTests(false);
2021-01-02 16:49:05 +03:00
writeln('Other tests '+Milliseconds()+'ms'+'. Tests compiled successfully ');
2018-06-03 20:49:55 +03:00
end;
if (ParamCount = 0) or (ParamStr(1) = '4') then
begin
RunAllTests(false);
2021-01-02 16:49:05 +03:00
writeln('Tests run successfully: '+Milliseconds()+'ms');
2018-06-03 20:49:55 +03:00
ClearExeDir;
DeletePCUFiles;
end;
if (ParamCount = 0) or (ParamStr(1) = '5') then
begin
2019-10-06 13:38:27 +03:00
CompileAllRunTests(false, true);
writeln('Tests in 32bit mode compiled successfully');
RunAllTests(false);
writeln('Tests in 32bit run successfully');
ClearExeDir;
CompileAllRunTests(true);
writeln('Tests with pabcrtl compiled successfully');
CompileAllCompilationTests('pabcrtl_tests', true);
2019-10-06 13:38:27 +03:00
end;
if (ParamCount = 0) or (ParamStr(1) = '6') then
begin
RunAllTests(false);
writeln('Tests with pabcrtl run successfully');
2018-06-03 20:49:55 +03:00
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
RunExpressionsExtractTests;
writeln('Intellisense expression tests run successfully');
RunIntellisenseTests;
writeln('Intellisense tests run successfully');
RunFormatterTests;
writeln('Formatter tests run successfully');
end;
except
on e: Exception do
2021-01-05 14:53:09 +03:00
begin
if nogui then
raise new Exception(e.ToString());
2018-06-03 20:49:55 +03:00
assert(false, e.ToString());
2021-01-05 14:53:09 +03:00
end;
end;
2015-05-14 22:35:07 +03:00
end.