Browse Source

* support 'true'/'false' for SetOrdProp on booleans (fixes #9347)
+ test for that bug, plus another test based on it which doesn't work yet

git-svn-id: trunk@8247 -

Jonas Maebe 18 years ago
parent
commit
b43404964c
3 changed files with 50 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 21 0
      tests/webtbs/tw9347.pp
  3. 27 0
      tests/webtbs/tw9347a.pp

+ 2 - 0
.gitattributes

@@ -8368,6 +8368,8 @@ tests/webtbs/tw9299.pp -text
 tests/webtbs/tw9306a.pp -text
 tests/webtbs/tw9306b.pp -text
 tests/webtbs/tw9309.pp -text
+tests/webtbs/tw9347.pp svneol=native#text/plain
+tests/webtbs/tw9347a.pp svneol=native#text/plain
 tests/webtbs/tw9384.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain

+ 21 - 0
tests/webtbs/tw9347.pp

@@ -0,0 +1,21 @@
+{$ifdef fpc}
+{$mode delphi}
+{$endif}
+
+{$r-}
+uses
+  SysUtils, Classes, TypInfo, Variants;
+
+type
+  TBla = class(TPersistent)
+  private
+    fBool: Boolean;
+    fint: integer;
+  published
+    property Bool: Boolean read fBool write fBool;
+    property int: integer read fint write fint;
+  end;
+
+begin
+  SetPropValue(TBla.Create, 'Bool', 'true');
+end.

+ 27 - 0
tests/webtbs/tw9347a.pp

@@ -0,0 +1,27 @@
+{$ifdef fpc}
+{$mode delphi}
+{$endif}
+
+{$r-}
+uses
+  SysUtils, Classes, TypInfo, Variants;
+
+type
+  TBla = class(TPersistent)
+  private
+    fBool: Boolean;
+    fint: integer;
+  published
+    property Bool: Boolean read fBool write fBool;
+    property int: integer read fint write fint;
+  end;
+
+begin
+  try
+    { delphi gives a range error here, also if range checking is off }
+    SetPropValue(TBla.Create, 'Bool', 2);
+  except on ERangeError do
+    halt(0);
+  end;
+  halt(1);
+end.