Browse Source

+ tests for mantis #21505 (bug already fixed in r21975/21983)

git-svn-id: trunk@23076 -
Jonas Maebe 12 years ago
parent
commit
d37c790ee6
3 changed files with 50 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 12 0
      tests/webtbs/tw21505.pp
  3. 36 0
      tests/webtbs/tw21505a.pp

+ 2 - 0
.gitattributes

@@ -12905,6 +12905,8 @@ tests/webtbs/tw21443.pp svneol=native#text/plain
 tests/webtbs/tw2145.pp svneol=native#text/plain
 tests/webtbs/tw21457.pp svneol=native#text/pascal
 tests/webtbs/tw21472.pp svneol=native#text/pascal
+tests/webtbs/tw21505.pp svneol=native#text/plain
+tests/webtbs/tw21505a.pp svneol=native#text/plain
 tests/webtbs/tw21538.pp svneol=native#text/pascal
 tests/webtbs/tw21550.pp svneol=native#text/pascal
 tests/webtbs/tw21551.pp svneol=native#text/plain

+ 12 - 0
tests/webtbs/tw21505.pp

@@ -0,0 +1,12 @@
+{$mode objfpc}{$H+}
+
+operator >< (A, B: Integer): Integer;
+begin
+  Result := A - B;
+end;
+
+begin
+  Writeln(2 >< 3);
+  if (2 >< 3) <> -1 then
+    halt(1);
+end.

+ 36 - 0
tests/webtbs/tw21505a.pp

@@ -0,0 +1,36 @@
+{$mode objfpc}{$H+}
+
+type
+  PPosList = ^TPosList;
+  TPosList = record
+    elem : Double;
+    tail : ^TPosList;
+  end;
+
+  operator >< (e : single; list : PPosList) : PPosList;
+  begin
+    new (result);
+    result^.elem := e;
+    result^.tail := list;
+  end;
+
+var
+  list : PPosList;
+begin
+// This makes Fatal: Internal error 2008022101
+//  list := 1.0 >< 3.0 >< 5.0 >< 7.0 >< 9.0 >< nil;
+// This says Error: Operation "><" not supported for types "ShortInt" and "Pointer"
+  list := 1.0 >< (3.0 >< (5.0 >< (7.0 >< (9.0 >< nil))));
+  if list^.elem<>1.0 then
+    halt(1);
+  if list^.tail^.elem<>3.0 then
+    halt(2);
+  if list^.tail^.tail^.elem<>5.0 then
+    halt(3);
+  if list^.tail^.tail^.tail^.elem<>7.0 then
+    halt(4);
+  if list^.tail^.tail^.tail^.tail^.elem<>9.0 then
+    halt(5);
+  if list^.tail^.tail^.tail^.tail^.tail<>nil then
+    halt(6);
+end.