Browse Source

new tests for mode macpas

git-svn-id: trunk@1592 -
olle 20 years ago
parent
commit
58582a44a9
3 changed files with 82 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 24 0
      tests/test/tmacfunret.pp
  3. 56 0
      tests/test/tmacprocvar.pp

+ 2 - 0
.gitattributes

@@ -5335,10 +5335,12 @@ tests/test/tinterrupt.pp svneol=native#text/plain
 tests/test/tintuint.pp svneol=native#text/plain
 tests/test/tlibrary1.pp svneol=native#text/plain
 tests/test/tlibrary2.pp svneol=native#text/plain
+tests/test/tmacfunret.pp svneol=native#text/plain
 tests/test/tmacpas1.pp svneol=native#text/plain
 tests/test/tmacpas2.pp svneol=native#text/plain
 tests/test/tmacpas3.pp svneol=native#text/plain
 tests/test/tmacpas4.pp svneol=native#text/plain
+tests/test/tmacprocvar.pp svneol=native#text/plain
 tests/test/tmath1.pp svneol=native#text/plain
 tests/test/tmmx1.pp svneol=native#text/plain
 tests/test/tmove.pp svneol=native#text/plain

+ 24 - 0
tests/test/tmacfunret.pp

@@ -0,0 +1,24 @@
+program tmacfunret;
+  {$MODE MACPAS}
+
+  procedure B(var x: Integer);
+
+  begin
+    x:= 42;
+  end;
+
+  function A: Integer;
+
+  begin
+    B(A);
+  end;
+
+var
+  i: Integer;
+
+begin
+  i:= A;
+  Writeln(i);
+  if i <> 42 then
+    halt(1);
+end.

+ 56 - 0
tests/test/tmacprocvar.pp

@@ -0,0 +1,56 @@
+program tmacprocvar;
+
+{$MODE MACPAS}
+
+{Tests of different ways of handling functions in MW, THINK Pascal and FPC}
+
+	type
+		SInt8 = -128..127;
+		Ptr = ^SInt8;
+		ProcPtr = Ptr; {This is the definition of ProcPtr in Apples Univ Interfaces}
+
+	procedure A;
+
+	begin
+		Writeln('Hello');
+	end;
+
+	procedure B (procedure X);
+	begin
+		X;
+	end;
+
+{$IFC UNDEFINED THINK_Pascal }
+{ ** Not supported in THINK Pascal ** }
+
+	type
+		M = procedure;
+
+	var
+		n: M;
+
+	procedure C (Y: M);
+	begin
+		Y;
+	end;
+{$ENDC}
+
+	procedure D (Z: ProcPtr);
+	begin
+		Writeln(Ord(Z));
+	end;
+
+begin
+	B(A);
+	D(@A);
+  {$IFC UNDEFINED THINK_Pascal }
+  { ** Not supported in THINK Pascal ** }
+	B(@A);
+	n := nil;
+	n := A;
+	if nil <> n then
+		C(n);
+	C(A);
+	C(@A);
+  {$ENDC}
+end.