fix in patterns
This commit is contained in:
parent
df8a5445ec
commit
88d406d9b6
|
|
@ -319,6 +319,8 @@ namespace PascalABCCompiler.PCU
|
||||||
{
|
{
|
||||||
if (base_type != null && base_type.IsDelegate)
|
if (base_type != null && base_type.IsDelegate)
|
||||||
return base_type.find_in_type(name, CurrentScope, no_search_in_extension_methods);
|
return base_type.find_in_type(name, CurrentScope, no_search_in_extension_methods);
|
||||||
|
else if (name == compiler_string_consts.deconstruct_method_name)
|
||||||
|
return SystemLibrary.SystemLibrary.object_type.find_in_type(name, CurrentScope, no_search_in_extension_methods);
|
||||||
return sil;
|
return sil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
var parameterTypes = variableDefinitions.Select(x => x.vars_type == null ? null : convert_strong(x.vars_type)).ToArray();
|
var parameterTypes = variableDefinitions.Select(x => x.vars_type == null ? null : convert_strong(x.vars_type)).ToArray();
|
||||||
List<function_node> candidates = new List<function_node>();
|
List<function_node> candidates = new List<function_node>();
|
||||||
List<type_node[]> deducedParametersList = new List<type_node[]>();
|
List<type_node[]> deducedParametersList = new List<type_node[]>();
|
||||||
|
|
||||||
var allDeconstructs = patternInstance.type.find_in_type(compiler_string_consts.deconstruct_method_name, context.CurrentScope);
|
var allDeconstructs = patternInstance.type.find_in_type(compiler_string_consts.deconstruct_method_name, context.CurrentScope);
|
||||||
foreach (var canditateSymbol in allDeconstructs)
|
foreach (var canditateSymbol in allDeconstructs)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,11 @@ ExecHide.exe gacutil.exe /i ..\bin\Lib\PABCRtl.dll
|
||||||
|
|
||||||
cd ..\bin
|
cd ..\bin
|
||||||
REM MPGORunner.exe
|
REM MPGORunner.exe
|
||||||
TestRunner.exe
|
TestRunner.exe 1
|
||||||
|
TestRunner.exe 2
|
||||||
|
TestRunner.exe 3
|
||||||
|
TestRunner.exe 4
|
||||||
|
TestRunner.exe 5
|
||||||
|
|
||||||
cd ..\ReleaseGenerators
|
cd ..\ReleaseGenerators
|
||||||
PascalABCNET_ALL.bat
|
PascalABCNET_ALL.bat
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,11 @@ ExecHide.exe gacutil.exe /i ..\bin\Lib\PABCRtl.dll
|
||||||
|
|
||||||
cd ..\bin
|
cd ..\bin
|
||||||
REM MPGORunner.exe
|
REM MPGORunner.exe
|
||||||
TestRunner.exe
|
TestRunner.exe 1
|
||||||
|
TestRunner.exe 2
|
||||||
|
TestRunner.exe 3
|
||||||
|
TestRunner.exe 4
|
||||||
|
TestRunner.exe 5
|
||||||
cd ..
|
cd ..
|
||||||
GOTO EXIT
|
GOTO EXIT
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -9,8 +9,11 @@
|
||||||
|
|
||||||
uses PascalABCCompiler, System.IO, System.Diagnostics;
|
uses PascalABCCompiler, System.IO, System.Diagnostics;
|
||||||
|
|
||||||
var TestSuiteDir: string;
|
var
|
||||||
var PathSeparator: string := Path.DirectorySeparatorChar;
|
TestSuiteDir: string;
|
||||||
|
|
||||||
|
var
|
||||||
|
PathSeparator: string := Path.DirectorySeparatorChar;
|
||||||
|
|
||||||
function IsUnix: boolean;
|
function IsUnix: boolean;
|
||||||
begin
|
begin
|
||||||
|
|
@ -21,13 +24,13 @@ function GetTestSuiteDir: string;
|
||||||
begin
|
begin
|
||||||
var dir := Path.GetDirectoryName(GetEXEFileName());
|
var dir := Path.GetDirectoryName(GetEXEFileName());
|
||||||
var ind := dir.LastIndexOf('bin');
|
var ind := dir.LastIndexOf('bin');
|
||||||
Result := dir.Substring(0,ind)+'TestSuite';
|
Result := dir.Substring(0, ind) + 'TestSuite';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetLibDir: string;
|
function GetLibDir: string;
|
||||||
begin
|
begin
|
||||||
var dir := Path.GetDirectoryName(GetEXEFileName());
|
var dir := Path.GetDirectoryName(GetEXEFileName());
|
||||||
Result := dir+PathSeparator+'Lib';
|
Result := dir + PathSeparator + 'Lib';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CompileErrorTests(withide: boolean);
|
procedure CompileErrorTests(withide: boolean);
|
||||||
|
|
@ -35,15 +38,15 @@ begin
|
||||||
|
|
||||||
var comp := new Compiler();
|
var comp := new Compiler();
|
||||||
|
|
||||||
var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'errors','*.pas');
|
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'errors', '*.pas');
|
||||||
for var i := 0 to files.Length - 1 do
|
for var i := 0 to files.Length - 1 do
|
||||||
begin
|
begin
|
||||||
var content := &File.ReadAllText(files[i]);
|
var content := &File.ReadAllText(files[i]);
|
||||||
if content.StartsWith('//winonly') and IsUnix then
|
if content.StartsWith('//winonly') and IsUnix then
|
||||||
continue;
|
continue;
|
||||||
var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton);
|
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
|
||||||
co.Debug := true;
|
co.Debug := true;
|
||||||
co.OutputDirectory := TestSuiteDir+PathSeparator+'errors';
|
co.OutputDirectory := TestSuiteDir + PathSeparator + 'errors';
|
||||||
co.UseDllForSystemUnits := false;
|
co.UseDllForSystemUnits := false;
|
||||||
co.RunWithEnvironment := withide;
|
co.RunWithEnvironment := withide;
|
||||||
comp.ErrorsList.Clear();
|
comp.ErrorsList.Clear();
|
||||||
|
|
@ -52,13 +55,13 @@ begin
|
||||||
comp.Compile(co);
|
comp.Compile(co);
|
||||||
if comp.ErrorsList.Count = 0 then
|
if comp.ErrorsList.Count = 0 then
|
||||||
begin
|
begin
|
||||||
System.Windows.Forms.MessageBox.Show('Compilation of error sample '+files[i]+' was successfull'+System.Environment.NewLine);
|
System.Windows.Forms.MessageBox.Show('Compilation of error sample ' + files[i] + ' was successfull' + System.Environment.NewLine);
|
||||||
Halt();
|
Halt();
|
||||||
end
|
end
|
||||||
else if comp.ErrorsList.Count = 1 then
|
else if comp.ErrorsList.Count = 1 then
|
||||||
begin
|
begin
|
||||||
if comp.ErrorsList[0].GetType() = typeof(PascalABCCompiler.Errors.CompilerInternalError) then
|
if comp.ErrorsList[0].GetType() = typeof(PascalABCCompiler.Errors.CompilerInternalError) then
|
||||||
System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString());
|
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
|
||||||
end;
|
end;
|
||||||
if i mod 20 = 0 then
|
if i mod 20 = 0 then
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
|
|
@ -71,15 +74,15 @@ begin
|
||||||
|
|
||||||
var comp := new Compiler();
|
var comp := new Compiler();
|
||||||
|
|
||||||
var files := Directory.GetFiles(TestSuiteDir,'*.pas');
|
var files := Directory.GetFiles(TestSuiteDir, '*.pas');
|
||||||
for var i := 0 to files.Length - 1 do
|
for var i := 0 to files.Length - 1 do
|
||||||
begin
|
begin
|
||||||
var content := &File.ReadAllText(files[i]);
|
var content := &File.ReadAllText(files[i]);
|
||||||
if content.StartsWith('//winonly') and IsUnix then
|
if content.StartsWith('//winonly') and IsUnix then
|
||||||
continue;
|
continue;
|
||||||
var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton);
|
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
|
||||||
co.Debug := true;
|
co.Debug := true;
|
||||||
co.OutputDirectory := TestSuiteDir+PathSeparator+'exe';
|
co.OutputDirectory := TestSuiteDir + PathSeparator + 'exe';
|
||||||
co.UseDllForSystemUnits := withdll;
|
co.UseDllForSystemUnits := withdll;
|
||||||
co.RunWithEnvironment := false;
|
co.RunWithEnvironment := false;
|
||||||
co.IgnoreRtlErrors := false;
|
co.IgnoreRtlErrors := false;
|
||||||
|
|
@ -90,7 +93,7 @@ begin
|
||||||
comp.Compile(co);
|
comp.Compile(co);
|
||||||
if comp.ErrorsList.Count > 0 then
|
if comp.ErrorsList.Count > 0 then
|
||||||
begin
|
begin
|
||||||
System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString());
|
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
|
||||||
Halt();
|
Halt();
|
||||||
end;
|
end;
|
||||||
if i mod 20 = 0 then
|
if i mod 20 = 0 then
|
||||||
|
|
@ -106,15 +109,15 @@ begin
|
||||||
|
|
||||||
var comp := new Compiler();
|
var comp := new Compiler();
|
||||||
|
|
||||||
var files := Directory.GetFiles(TestSuiteDir+PathSeparator+dir,'*.pas');
|
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + dir, '*.pas');
|
||||||
for var i := 0 to files.Length - 1 do
|
for var i := 0 to files.Length - 1 do
|
||||||
begin
|
begin
|
||||||
var content := &File.ReadAllText(files[i]);
|
var content := &File.ReadAllText(files[i]);
|
||||||
if content.StartsWith('//winonly') and IsUnix then
|
if content.StartsWith('//winonly') and IsUnix then
|
||||||
continue;
|
continue;
|
||||||
var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton);
|
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
|
||||||
co.Debug := true;
|
co.Debug := true;
|
||||||
co.OutputDirectory := TestSuiteDir+PathSeparator+dir;
|
co.OutputDirectory := TestSuiteDir + PathSeparator + dir;
|
||||||
co.UseDllForSystemUnits := withdll;
|
co.UseDllForSystemUnits := withdll;
|
||||||
co.RunWithEnvironment := false;
|
co.RunWithEnvironment := false;
|
||||||
co.IgnoreRtlErrors := false;
|
co.IgnoreRtlErrors := false;
|
||||||
|
|
@ -124,7 +127,7 @@ begin
|
||||||
comp.Compile(co);
|
comp.Compile(co);
|
||||||
if comp.ErrorsList.Count > 0 then
|
if comp.ErrorsList.Count > 0 then
|
||||||
begin
|
begin
|
||||||
System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString());
|
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
|
||||||
Halt();
|
Halt();
|
||||||
end;
|
end;
|
||||||
if i mod 20 = 0 then
|
if i mod 20 = 0 then
|
||||||
|
|
@ -136,14 +139,14 @@ end;
|
||||||
procedure CompileAllUnits;
|
procedure CompileAllUnits;
|
||||||
begin
|
begin
|
||||||
var comp := new Compiler();
|
var comp := new Compiler();
|
||||||
var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'units','*.pas');
|
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'units', '*.pas');
|
||||||
var dir := TestSuiteDir+PathSeparator+'units'+PathSeparator;
|
var dir := TestSuiteDir + PathSeparator + 'units' + PathSeparator;
|
||||||
for var i := 0 to files.Length - 1 do
|
for var i := 0 to files.Length - 1 do
|
||||||
begin
|
begin
|
||||||
var content := &File.ReadAllText(files[i]);
|
var content := &File.ReadAllText(files[i]);
|
||||||
if content.StartsWith('//winonly') and IsUnix then
|
if content.StartsWith('//winonly') and IsUnix then
|
||||||
continue;
|
continue;
|
||||||
var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton);
|
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
|
||||||
co.Debug := true;
|
co.Debug := true;
|
||||||
co.OutputDirectory := dir;
|
co.OutputDirectory := dir;
|
||||||
co.UseDllForSystemUnits := false;
|
co.UseDllForSystemUnits := false;
|
||||||
|
|
@ -153,7 +156,7 @@ begin
|
||||||
comp.Compile(co);
|
comp.Compile(co);
|
||||||
if comp.ErrorsList.Count > 0 then
|
if comp.ErrorsList.Count > 0 then
|
||||||
begin
|
begin
|
||||||
System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString());
|
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
|
||||||
Halt();
|
Halt();
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
@ -165,22 +168,22 @@ begin
|
||||||
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
|
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
|
||||||
var comp := new Compiler();
|
var comp := new Compiler();
|
||||||
|
|
||||||
var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'usesunits','*.pas');
|
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'usesunits', '*.pas');
|
||||||
for var i := 0 to files.Length - 1 do
|
for var i := 0 to files.Length - 1 do
|
||||||
begin
|
begin
|
||||||
var content := &File.ReadAllText(files[i]);
|
var content := &File.ReadAllText(files[i]);
|
||||||
if content.StartsWith('//winonly') and IsUnix then
|
if content.StartsWith('//winonly') and IsUnix then
|
||||||
continue;
|
continue;
|
||||||
var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton);
|
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
|
||||||
co.Debug := true;
|
co.Debug := true;
|
||||||
co.OutputDirectory := TestSuiteDir+PathSeparator+'exe';
|
co.OutputDirectory := TestSuiteDir + PathSeparator + 'exe';
|
||||||
co.UseDllForSystemUnits := false;
|
co.UseDllForSystemUnits := false;
|
||||||
comp.ErrorsList.Clear();
|
comp.ErrorsList.Clear();
|
||||||
comp.Warnings.Clear();
|
comp.Warnings.Clear();
|
||||||
comp.Compile(co);
|
comp.Compile(co);
|
||||||
if comp.ErrorsList.Count > 0 then
|
if comp.ErrorsList.Count > 0 then
|
||||||
begin
|
begin
|
||||||
System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString());
|
System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString());
|
||||||
Halt();
|
Halt();
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
@ -190,42 +193,42 @@ end;
|
||||||
procedure CopyPCUFiles;
|
procedure CopyPCUFiles;
|
||||||
begin
|
begin
|
||||||
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
|
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
|
||||||
var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'units','*.pcu');
|
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'units', '*.pcu');
|
||||||
|
|
||||||
foreach fname: string in files do
|
foreach fname: string in files do
|
||||||
begin
|
begin
|
||||||
&File.Move(fname,TestSuiteDir+PathSeparator+'usesunits'+PathSeparator+Path.GetFileName(fname));
|
&File.Move(fname, TestSuiteDir + PathSeparator + 'usesunits' + PathSeparator + Path.GetFileName(fname));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RunAllTests(redirectIO: boolean);
|
procedure RunAllTests(redirectIO: boolean);
|
||||||
begin
|
begin
|
||||||
var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'exe','*.exe');
|
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'exe', '*.exe');
|
||||||
for var i := 0 to files.Length - 1 do
|
for var i := 0 to files.Length - 1 do
|
||||||
begin
|
begin
|
||||||
var psi := new System.Diagnostics.ProcessStartInfo(files[i]);
|
var psi := new System.Diagnostics.ProcessStartInfo(files[i]);
|
||||||
psi.CreateNoWindow := true;
|
psi.CreateNoWindow := true;
|
||||||
psi.UseShellExecute := false;
|
psi.UseShellExecute := false;
|
||||||
|
|
||||||
psi.WorkingDirectory := TestSuiteDir+PathSeparator+'exe';
|
psi.WorkingDirectory := TestSuiteDir + PathSeparator + 'exe';
|
||||||
{psi.RedirectStandardInput := true;
|
{psi.RedirectStandardInput := true;
|
||||||
psi.RedirectStandardOutput := true;
|
psi.RedirectStandardOutput := true;
|
||||||
psi.RedirectStandardError := true;}
|
psi.RedirectStandardError := true;}
|
||||||
var p: Process := new Process();
|
var p: Process := new Process();
|
||||||
p.StartInfo := psi;
|
p.StartInfo := psi;
|
||||||
p.Start();
|
p.Start();
|
||||||
if redirectIO then
|
if redirectIO then
|
||||||
p.StandardInput.WriteLine('GO');
|
p.StandardInput.WriteLine('GO');
|
||||||
//p.StandardInput.AutoFlush := true;
|
//p.StandardInput.AutoFlush := true;
|
||||||
//var p := System.Diagnostics.Process.Start(psi);
|
//var p := System.Diagnostics.Process.Start(psi);
|
||||||
|
|
||||||
while not p.HasExited do
|
while not p.HasExited do
|
||||||
Sleep(10);
|
Sleep(10);
|
||||||
if p.ExitCode <> 0 then
|
if p.ExitCode <> 0 then
|
||||||
begin
|
begin
|
||||||
System.Windows.Forms.MessageBox.Show('Running of '+files[i]+' failed. Exit code is not 0');
|
System.Windows.Forms.MessageBox.Show('Running of ' + files[i] + ' failed. Exit code is not 0');
|
||||||
Halt;
|
Halt;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
@ -238,45 +241,45 @@ function GetLineByPos(lines: array of string; pos: integer): integer;
|
||||||
begin
|
begin
|
||||||
var cum_pos := 0;
|
var cum_pos := 0;
|
||||||
for var i := 0 to lines.Length - 1 do
|
for var i := 0 to lines.Length - 1 do
|
||||||
for var j := 0 to lines[j].Length - 1 do
|
for var j := 0 to lines[j].Length - 1 do
|
||||||
begin
|
|
||||||
if cum_pos = pos then
|
|
||||||
begin
|
begin
|
||||||
Result := i + 1;
|
if cum_pos = pos then
|
||||||
exit;
|
begin
|
||||||
|
Result := i + 1;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Inc(cum_pos);
|
||||||
end;
|
end;
|
||||||
Inc(cum_pos);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetColByPos(lines: array of string; pos: integer): integer;
|
function GetColByPos(lines: array of string; pos: integer): integer;
|
||||||
begin
|
begin
|
||||||
var cum_pos := 0;
|
var cum_pos := 0;
|
||||||
for var i := 0 to lines.Length - 1 do
|
for var i := 0 to lines.Length - 1 do
|
||||||
for var j := 0 to lines[j].Length - 1 do
|
for var j := 0 to lines[j].Length - 1 do
|
||||||
begin
|
|
||||||
if cum_pos = pos then
|
|
||||||
begin
|
begin
|
||||||
Result := j + 1;
|
if cum_pos = pos then
|
||||||
exit;
|
begin
|
||||||
|
Result := j + 1;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Inc(cum_pos);
|
||||||
end;
|
end;
|
||||||
Inc(cum_pos);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RunIntellisenseTests;
|
procedure RunIntellisenseTests;
|
||||||
begin
|
begin
|
||||||
PascalABCCompiler.StringResourcesLanguage.CurrentTwoLetterISO := 'ru';
|
PascalABCCompiler.StringResourcesLanguage.CurrentTwoLetterISO := 'ru';
|
||||||
CodeCompletion.CodeCompletionTester.TestIntellisense(TestSuiteDir+PathSeparator+'intellisense_tests');
|
CodeCompletion.CodeCompletionTester.TestIntellisense(TestSuiteDir + PathSeparator + 'intellisense_tests');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RunFormatterTests;
|
procedure RunFormatterTests;
|
||||||
begin
|
begin
|
||||||
CodeCompletion.FormatterTester.Test();
|
CodeCompletion.FormatterTester.Test();
|
||||||
var errors := &File.ReadAllText(TestSuiteDir+PathSeparator+'formatter_tests'+PathSeparator+'output'+PathSeparator+'log.txt');
|
var errors := &File.ReadAllText(TestSuiteDir + PathSeparator + 'formatter_tests' + PathSeparator + 'output' + PathSeparator + 'log.txt');
|
||||||
if not string.IsNullOrEmpty(errors) then
|
if not string.IsNullOrEmpty(errors) then
|
||||||
begin
|
begin
|
||||||
System.Windows.Forms.MessageBox.Show(errors+System.Environment.NewLine+'more info at TestSuite/formatter_tests/output/log.txt');
|
System.Windows.Forms.MessageBox.Show(errors + System.Environment.NewLine + 'more info at TestSuite/formatter_tests/output/log.txt');
|
||||||
Halt;
|
Halt;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
@ -296,34 +299,34 @@ end;
|
||||||
|
|
||||||
procedure ClearExeDir;
|
procedure ClearExeDir;
|
||||||
begin
|
begin
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'exe','*.*');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'exe', '*.*');
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'CompilationSamples','*.exe');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.exe');
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'CompilationSamples','*.mdb');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.mdb');
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'CompilationSamples','*.pdb');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.pdb');
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'CompilationSamples','*.pcu');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.pcu');
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'pabcrtl_tests','*.exe');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.exe');
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'pabcrtl_tests','*.pdb');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.pdb');
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'pabcrtl_tests','*.mdb');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.mdb');
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'pabcrtl_tests','*.pcu');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.pcu');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DeletePCUFiles;
|
procedure DeletePCUFiles;
|
||||||
begin
|
begin
|
||||||
ClearDirByPattern(TestSuiteDir+PathSeparator+'usesunits','*.pcu');
|
ClearDirByPattern(TestSuiteDir + PathSeparator + 'usesunits', '*.pcu');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DeletePABCSystemPCU;
|
procedure DeletePABCSystemPCU;
|
||||||
begin
|
begin
|
||||||
var dir := Path.Combine(Path.GetDirectoryName(GetEXEFileName()),'Lib');
|
var dir := Path.Combine(Path.GetDirectoryName(GetEXEFileName()), 'Lib');
|
||||||
var pcu := Path.Combine(dir,'PABCSystem.pcu');
|
var pcu := Path.Combine(dir, 'PABCSystem.pcu');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CopyLibFiles;
|
procedure CopyLibFiles;
|
||||||
begin
|
begin
|
||||||
var files := Directory.GetFiles(GetLibDir(),'*.pas');
|
var files := Directory.GetFiles(GetLibDir(), '*.pas');
|
||||||
foreach f: string in files do
|
foreach f: string in files do
|
||||||
begin
|
begin
|
||||||
&File.Copy(f, TestSuiteDir+PathSeparator+'CompilationSamples'+PathSeparator+Path.GetFileName(f), true);
|
&File.Copy(f, TestSuiteDir + PathSeparator + 'CompilationSamples' + PathSeparator + Path.GetFileName(f), true);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
@ -332,39 +335,55 @@ begin
|
||||||
try
|
try
|
||||||
TestSuiteDir := GetTestSuiteDir;
|
TestSuiteDir := GetTestSuiteDir;
|
||||||
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
|
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
|
||||||
DeletePCUFiles;
|
if (ParamCount = 0) or (ParamStr(1) = '1') then
|
||||||
ClearExeDir;
|
begin
|
||||||
CompileAllRunTests(false);
|
DeletePCUFiles;
|
||||||
CopyLibFiles;
|
ClearExeDir;
|
||||||
CompileAllCompilationTests('CompilationSamples',false);
|
CompileAllRunTests(false);
|
||||||
CompileAllUnits;
|
end;
|
||||||
CopyPCUFiles;
|
|
||||||
CompileAllUsesUnits;
|
if (ParamCount = 0) or (ParamStr(1) = '2') then
|
||||||
CompileErrorTests(false);
|
begin
|
||||||
writeln('Tests compiled successfully');
|
CopyLibFiles;
|
||||||
RunAllTests(false);
|
CompileAllCompilationTests('CompilationSamples', false);
|
||||||
writeln('Tests run successfully');
|
end;
|
||||||
ClearExeDir;
|
if (ParamCount = 0) or (ParamStr(1) = '3') then
|
||||||
DeletePCUFiles;
|
begin
|
||||||
CompileAllRunTests(true);
|
CompileAllUnits;
|
||||||
writeln('Tests with pabcrtl compiled successfully');
|
CopyPCUFiles;
|
||||||
CompileAllCompilationTests('pabcrtl_tests',true);
|
CompileAllUsesUnits;
|
||||||
RunAllTests(false);
|
CompileErrorTests(false);
|
||||||
writeln('Tests with pabcrtl run successfully');
|
writeln('Tests compiled successfully');
|
||||||
ClearExeDir;
|
end;
|
||||||
CompileAllRunTests(false, true);
|
if (ParamCount = 0) or (ParamStr(1) = '4') then
|
||||||
writeln('Tests in 32bit mode compiled successfully');
|
begin
|
||||||
RunAllTests(false);
|
RunAllTests(false);
|
||||||
writeln('Tests in 32bit run successfully');
|
writeln('Tests run successfully');
|
||||||
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
|
ClearExeDir;
|
||||||
RunExpressionsExtractTests;
|
DeletePCUFiles;
|
||||||
writeln('Intellisense expression tests run successfully');
|
end;
|
||||||
RunIntellisenseTests;
|
if (ParamCount = 0) or (ParamStr(1) = '5') then
|
||||||
writeln('Intellisense tests run successfully');
|
begin
|
||||||
RunFormatterTests;
|
CompileAllRunTests(true);
|
||||||
writeln('Formatter tests run successfully');
|
writeln('Tests with pabcrtl compiled successfully');
|
||||||
|
CompileAllCompilationTests('pabcrtl_tests', true);
|
||||||
|
RunAllTests(false);
|
||||||
|
writeln('Tests with pabcrtl run successfully');
|
||||||
|
ClearExeDir;
|
||||||
|
CompileAllRunTests(false, true);
|
||||||
|
writeln('Tests in 32bit mode compiled successfully');
|
||||||
|
RunAllTests(false);
|
||||||
|
writeln('Tests in 32bit run successfully');
|
||||||
|
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
|
except
|
||||||
on e: Exception do
|
on e: Exception do
|
||||||
assert(false,e.ToString());
|
assert(false, e.ToString());
|
||||||
end;
|
end;
|
||||||
end.
|
end.
|
||||||
Loading…
Reference in a new issue