Browse Source

tests: add tests for "dot units"/namespaces feature (compiler changes will be committed later)

git-svn-id: trunk@18855 -
paul 14 năm trước cách đây
mục cha
commit
60ccec6f56

+ 10 - 0
.gitattributes

@@ -9924,6 +9924,10 @@ tests/test/tdel2.pp svneol=native#text/plain
 tests/test/tdispinterface1a.pp svneol=native#text/pascal
 tests/test/tdispinterface1b.pp svneol=native#text/pascal
 tests/test/tdispinterface2.pp svneol=native#text/plain
+tests/test/tdotunits1.pp svneol=native#text/pascal
+tests/test/tdotunits2.pp svneol=native#text/pascal
+tests/test/tdotunits3.pp svneol=native#text/pascal
+tests/test/tdotunits4.pp svneol=native#text/pascal
 tests/test/tendian1.pp svneol=native#text/plain
 tests/test/tenum1.pp svneol=native#text/plain
 tests/test/tenum2.pp svneol=native#text/plain
@@ -10521,6 +10525,12 @@ tests/test/twrstr8.pp svneol=native#text/plain
 tests/test/uabstrcl.pp svneol=native#text/plain
 tests/test/uchlp12.pp svneol=native#text/pascal
 tests/test/uchlp18.pp svneol=native#text/pascal
+tests/test/udots.dot.next.pp svneol=native#text/pascal
+tests/test/udots.dot.pp svneol=native#text/pascal
+tests/test/udots.dot.prog.pp svneol=native#text/pascal
+tests/test/udots.pp svneol=native#text/pascal
+tests/test/udots.prog.pp svneol=native#text/pascal
+tests/test/udots.test.pp svneol=native#text/pascal
 tests/test/uenum2a.pp svneol=native#text/plain
 tests/test/uenum2b.pp svneol=native#text/plain
 tests/test/ugeneric10.pp svneol=native#text/plain

+ 14 - 0
tests/test/tdotunits1.pp

@@ -0,0 +1,14 @@
+{%fail}
+{%norun}
+program tdotunits1;
+
+{$mode delphi}
+
+uses
+  udots.dot.next, udots;
+
+begin
+  // this identifier can't be resolved because namespace udots.dot hides the udots unit visibility
+  udots.dot.test := 1;
+end.
+

+ 13 - 0
tests/test/tdotunits2.pp

@@ -0,0 +1,13 @@
+{%norun}
+program tdotunits2;
+
+{$mode delphi}
+
+uses
+  udots.dot, udots.dot.next, udots;
+
+begin
+  // this identifier should be resolved to test variable from udots.dot unit
+  udots.dot.test := 'c';
+end.
+

+ 24 - 0
tests/test/tdotunits3.pp

@@ -0,0 +1,24 @@
+{%norun}
+program tdotunits3;
+
+{$mode delphi}
+
+uses
+  udots.dot.next, udots;
+
+type
+  TDot = record
+    test: string;
+  end;
+
+  TUdots = record
+    dot: TDot;
+  end;
+
+var
+  udots: TUdots;
+begin
+  // this identifier should be resolved to local udots variable
+  udots.dot.test := 'test';
+end.
+

+ 12 - 0
tests/test/tdotunits4.pp

@@ -0,0 +1,12 @@
+{%fail}
+{%norun}
+program tdotunits4;
+
+{$mode delphi}
+
+uses
+  udots.test;
+
+begin
+end.
+

+ 14 - 0
tests/test/udots.dot.next.pp

@@ -0,0 +1,14 @@
+unit udots.dot.next;
+
+interface
+
+type
+  ttest=byte;
+
+var
+  test: integer;
+
+implementation
+
+end.
+

+ 24 - 0
tests/test/udots.dot.pp

@@ -0,0 +1,24 @@
+unit udots.dot;
+
+interface
+
+var
+  test: char;
+
+implementation
+
+uses
+  udots, udots.dot.next;
+
+// test that type is resolved
+var
+  test1: udots.dot.next.ttest;
+
+procedure t;
+begin
+  // test that we resolved the next identifier to the local variable test
+  udots.dot.test := 'c';
+end;
+
+end.
+

+ 15 - 0
tests/test/udots.dot.prog.pp

@@ -0,0 +1,15 @@
+{%fail}
+{%norun}
+program udots.dot.prog;
+
+{$mode delphi}
+
+uses
+  udots;
+
+begin
+  // this must fail because we have a namespace udots.dot and it has no unit test
+  udots.dot.test := 1;
+end.
+
+

+ 13 - 0
tests/test/udots.pp

@@ -0,0 +1,13 @@
+unit udots;
+
+interface
+
+var
+  dot: record
+    test: integer;
+  end;
+
+implementation
+
+end.
+

+ 14 - 0
tests/test/udots.prog.pp

@@ -0,0 +1,14 @@
+{%norun}
+program udots.prog;
+
+{$mode delphi}
+
+uses
+  udots;
+
+begin
+  // this should not fail although we have a namespace udots and a unit udots
+  udots.dot.test := 1;
+end.
+
+

+ 15 - 0
tests/test/udots.test.pp

@@ -0,0 +1,15 @@
+unit udots.test;
+
+interface
+
+// this must fail
+var
+  test: udots.dot.next.ttest;
+
+implementation
+
+uses
+  udots.dot.next;
+
+end.
+