diff --git a/.gitattributes b/.gitattributes index 7d2c7faf61..9f3c7b1307 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/components/codetools/tests/finddeclarationtests.pas b/components/codetools/tests/finddeclarationtests.pas index fc68dbfaf9..47eb9b2a6d 100644 --- a/components/codetools/tests/finddeclarationtests.pas +++ b/components/codetools/tests/finddeclarationtests.pas @@ -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; diff --git a/components/codetools/tests/fpctests/tudots.dot.pp b/components/codetools/tests/fpctests/tudots.dot.pp index f642870ecd..17771e349d 100644 --- a/components/codetools/tests/fpctests/tudots.dot.pp +++ b/components/codetools/tests/fpctests/tudots.dot.pp @@ -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. diff --git a/components/codetools/tests/fpctests/tudots.dot.prog.pp b/components/codetools/tests/fpctests/tudots.dot.prog.pp index 2af8c82ddf..84eae465d1 100644 --- a/components/codetools/tests/fpctests/tudots.dot.prog.pp +++ b/components/codetools/tests/fpctests/tudots.dot.prog.pp @@ -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. diff --git a/components/codetools/tests/fpctests/tudots.test.pp b/components/codetools/tests/fpctests/tudots.test.pp index 3366a3969e..a53d6fb668 100644 --- a/components/codetools/tests/fpctests/tudots.test.pp +++ b/components/codetools/tests/fpctests/tudots.test.pp @@ -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. diff --git a/components/codetools/tests/laztests/unit_order_a.pas b/components/codetools/tests/laztests/unit_order_a.pas new file mode 100644 index 0000000000..577a2c34c3 --- /dev/null +++ b/components/codetools/tests/laztests/unit_order_a.pas @@ -0,0 +1,14 @@ +unit unit_order_a; + +{$mode objfpc}{$H+} + +interface + +var + unit_order_b: char; + + +implementation + +end. + diff --git a/components/codetools/tests/laztests/unit_order_b.pas b/components/codetools/tests/laztests/unit_order_b.pas new file mode 100644 index 0000000000..05d2284f40 --- /dev/null +++ b/components/codetools/tests/laztests/unit_order_b.pas @@ -0,0 +1,14 @@ +unit unit_order_b; + +{$mode objfpc}{$H+} + +interface + +var + unit_order_a: integer; + + +implementation + +end. + diff --git a/components/codetools/tests/laztests/unit_order_test.pas b/components/codetools/tests/laztests/unit_order_test.pas new file mode 100644 index 0000000000..6e92ec46fb --- /dev/null +++ b/components/codetools/tests/laztests/unit_order_test.pas @@ -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. + diff --git a/components/codetools/tests/laztests/unitdots.dot.pas b/components/codetools/tests/laztests/unitdots.dot.pas new file mode 100644 index 0000000000..faa41e0c5c --- /dev/null +++ b/components/codetools/tests/laztests/unitdots.dot.pas @@ -0,0 +1,14 @@ +unit unitdots.dot; + +{$mode objfpc}{$H+} + +interface + +var + test: integer; + foo: integer; + +implementation + +end. + diff --git a/components/codetools/tests/laztests/unitdots.main.pas b/components/codetools/tests/laztests/unitdots.main.pas new file mode 100644 index 0000000000..47b96220a7 --- /dev/null +++ b/components/codetools/tests/laztests/unitdots.main.pas @@ -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. + diff --git a/components/codetools/tests/laztests/unitdots.pas b/components/codetools/tests/laztests/unitdots.pas new file mode 100644 index 0000000000..f6f4ee2dd6 --- /dev/null +++ b/components/codetools/tests/laztests/unitdots.pas @@ -0,0 +1,18 @@ +unit unitdots; + +{$mode objfpc}{$H+} + +interface + +type + dots = record + test: char; + bar: char; + end; +var + my: boolean; + +implementation + +end. +