mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-01 02:52:38 +02:00
codetools: added tests unit order and namespaces
git-svn-id: trunk@50269 -
This commit is contained in:
parent
ba310dcf48
commit
40480bf39d
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -1026,6 +1026,12 @@ components/codetools/tests/laztests/bug28876.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/bug28877.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/delphi_autodereference1.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/tdefaultproperty1.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/unit_order_a.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/unit_order_b.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/unit_order_test.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/unitdots.dot.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/unitdots.main.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/unitdots.pas svneol=native#text/plain
|
||||
components/codetools/tests/parsertbase.pas svneol=native#text/plain
|
||||
components/codetools/tests/parsertest.lpi svneol=native#text/plain
|
||||
components/codetools/tests/parsertest.lpr svneol=native#text/plain
|
||||
|
@ -232,12 +232,16 @@ var
|
||||
Info: TSearchRec;
|
||||
aFilename, Param, aFileMask: String;
|
||||
i: Integer;
|
||||
Verbose: Boolean;
|
||||
begin
|
||||
aFileMask:='t*.p*';
|
||||
Verbose:=false;
|
||||
for i:=1 to ParamCount do begin
|
||||
Param:=ParamStr(i);
|
||||
if LeftStr(Param,length(fmparam))=fmparam then
|
||||
aFileMask:=copy(Param,length(fmparam)+1,100);
|
||||
if Param='-v' then
|
||||
Verbose:=true;
|
||||
end;
|
||||
Directory:=AppendPathDelim(Directory);
|
||||
|
||||
@ -246,6 +250,8 @@ begin
|
||||
if faDirectory and Info.Attr>0 then continue;
|
||||
aFilename:=Info.Name;
|
||||
if not FilenameIsPascalUnit(aFilename) then continue;
|
||||
if Verbose then
|
||||
debugln(['TTestFindDeclaration.TestFiles File="',aFilename,'"']);
|
||||
FindDeclarations(Directory+aFilename);
|
||||
until FindNextUTF8(Info)<>0;
|
||||
end;
|
||||
|
@ -10,16 +10,16 @@ procedure t;
|
||||
implementation
|
||||
|
||||
uses
|
||||
tudots{ todo declaration:tudots}, tudots.dot.next{ todo declaration:tudots.dot.next};
|
||||
tudots{declaration:tudots}, tudots.dot.next{ todo declaration:tudots.dot.next};
|
||||
|
||||
// test that type is resolved
|
||||
var
|
||||
test1: tudots.dot.next.ttest{ todo declaration:tudots.dot.next.ttest};
|
||||
test1: tudots.dot.next.ttest{declaration:tudots.dot.next.ttest};
|
||||
|
||||
procedure t;
|
||||
begin
|
||||
// test that we resolved the next identifier to the local variable test
|
||||
tudots.dot.test{ todo declaration:tudots.dot.test} := 'c';
|
||||
// test that we resolve the next identifier to the local variable test
|
||||
tudots.dot.test{declaration:tudots.dot.test} := 'c';
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -5,11 +5,11 @@ program tudots.dot.prog;
|
||||
{$mode delphi}
|
||||
|
||||
uses
|
||||
tudots{ todo declaration:tudots};
|
||||
tudots{declaration:tudots};
|
||||
|
||||
begin
|
||||
// this must fail because we have a namespace tudots.dot and it has no unit test
|
||||
tudots.dot.test{ todo } := 1;
|
||||
tudots.dot.test{ todo declaration:tudots.dot.test} := 1;
|
||||
end.
|
||||
|
||||
|
||||
|
@ -5,12 +5,12 @@ interface
|
||||
|
||||
// this must fail
|
||||
var
|
||||
test: tudots.dot.next.ttest{ todo };
|
||||
test: tudots.dot.next.ttest{declaration:-};
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
tudots.dot.next{ todo declaration:tudots.dot.next};
|
||||
tudots.dot.next{declaration:tudots.dot.next};
|
||||
|
||||
end.
|
||||
|
||||
|
14
components/codetools/tests/laztests/unit_order_a.pas
Normal file
14
components/codetools/tests/laztests/unit_order_a.pas
Normal file
@ -0,0 +1,14 @@
|
||||
unit unit_order_a;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
var
|
||||
unit_order_b: char;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
14
components/codetools/tests/laztests/unit_order_b.pas
Normal file
14
components/codetools/tests/laztests/unit_order_b.pas
Normal file
@ -0,0 +1,14 @@
|
||||
unit unit_order_b;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
var
|
||||
unit_order_a: integer;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
16
components/codetools/tests/laztests/unit_order_test.pas
Normal file
16
components/codetools/tests/laztests/unit_order_test.pas
Normal file
@ -0,0 +1,16 @@
|
||||
unit unit_order_test;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
unit_order_a, unit_order_b;
|
||||
|
||||
implementation
|
||||
|
||||
begin
|
||||
unit_order_b.unit_order_a{declaration:unit_order_b.unit_order_a}:=3;
|
||||
unit_order_a.unit_order_b{declaration:unit_order_a.unit_order_b}:='3';
|
||||
end.
|
||||
|
14
components/codetools/tests/laztests/unitdots.dot.pas
Normal file
14
components/codetools/tests/laztests/unitdots.dot.pas
Normal file
@ -0,0 +1,14 @@
|
||||
unit unitdots.dot;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
var
|
||||
test: integer;
|
||||
foo: integer;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
19
components/codetools/tests/laztests/unitdots.main.pas
Normal file
19
components/codetools/tests/laztests/unitdots.main.pas
Normal file
@ -0,0 +1,19 @@
|
||||
unit unitdots.main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
unitdots.dot, unitdots; // unit names (with or without namespaces) win over interface identifiers
|
||||
// even though the 'unitdots.dot' is left of 'unitdots'
|
||||
|
||||
implementation
|
||||
|
||||
begin
|
||||
unitdots.dot.test{declaration:unitdots.dot.test}:=3;
|
||||
unitdots.dot.foo{declaration:unitdots.dot.foo}:=4;
|
||||
//unitdots.dot.bar:='5'; fail!
|
||||
unitdots.my{declaration:unitdots.my}:=false;
|
||||
end.
|
||||
|
18
components/codetools/tests/laztests/unitdots.pas
Normal file
18
components/codetools/tests/laztests/unitdots.pas
Normal file
@ -0,0 +1,18 @@
|
||||
unit unitdots;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
type
|
||||
dots = record
|
||||
test: char;
|
||||
bar: char;
|
||||
end;
|
||||
var
|
||||
my: boolean;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user