Browse Source

* tests for checking type casts from integers/enums to TObjects in Delphi and non-Delphi mode (see r11398)

git-svn-id: trunk@11400 -
tom_at_work 17 years ago
parent
commit
f11cf59854
4 changed files with 44 additions and 0 deletions
  1. 3 0
      .gitattributes
  2. 14 0
      tests/tbf/tb0210.pp
  3. 11 0
      tests/tbf/tb0211.pp
  4. 16 0
      tests/tbs/tb0554.pp

+ 3 - 0
.gitattributes

@@ -6451,6 +6451,8 @@ tests/tbf/tb0206.pp svneol=native#text/plain
 tests/tbf/tb0207.pp svneol=native#text/plain
 tests/tbf/tb0208.pp svneol=native#text/plain
 tests/tbf/tb0209.pp svneol=native#text/plain
+tests/tbf/tb0210.pp svneol=native#text/plain
+tests/tbf/tb0211.pp svneol=native#text/plain
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain
 tests/tbf/ub0158a.pp svneol=native#text/plain
@@ -7001,6 +7003,7 @@ tests/tbs/tb0550b.pp svneol=native#text/plain
 tests/tbs/tb0551.pp svneol=native#text/plain
 tests/tbs/tb0552.pp svneol=native#text/plain
 tests/tbs/tb0553.pp svneol=native#text/plain
+tests/tbs/tb0554.pp svneol=native#text/plain
 tests/tbs/tb205.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain

+ 14 - 0
tests/tbf/tb0210.pp

@@ -0,0 +1,14 @@
+// check whether enums can NOT be casted to object references; this 
+// should NOT work in objfpc mode (see also tbs/tb0554.pp)
+{$mode objfpc}
+
+type
+  TEnum = (a, b, c);
+  
+var
+  e : TEnum;
+  o : TObject;
+
+begin
+  o := TObject(e);
+end.

+ 11 - 0
tests/tbf/tb0211.pp

@@ -0,0 +1,11 @@
+// check whether integers can NOT be casted to object references; this 
+// should NOT work in objfpc mode (see also tbs/tb0554.pp)
+{$mode objfpc}
+
+var
+  i : Integer;
+  o : TObject;
+
+begin
+  o := TObject(i);
+end.

+ 16 - 0
tests/tbs/tb0554.pp

@@ -0,0 +1,16 @@
+// check whether enums and integers can be casted to object references; this 
+// should work in Delphi mode (is Delphi compatible)
+{$mode delphi}
+
+type
+  TEnum = (a, b, c);
+  
+var
+  i : Integer;
+  e : TEnum;
+  o : TObject;
+
+begin
+  o := TObject(e);
+  o := TObject(i);
+end.