Pulling Set_Method and Run up, currently broken

gcc -c -Isrc/ -I- src/testa.adb
    gcc -c -Isrc/ -I- src/wasrun.adb
    gcc -c -Isrc/ -I- src/wasrun_runner.adb
    wasrun_runner.adb:10:46: expected type "Test_Method_Type" defined at testa.ads:4
    wasrun_runner.adb:10:46: found type access to procedure "Test_Method" defined at line 10
    gnatmake: "src/wasrun_runner.adb" compilation error
This commit is contained in:
R. Tyler Croy 2011-12-29 23:31:36 -08:00
parent 40ea1ceafb
commit 45122af49a
4 changed files with 7 additions and 20 deletions

View File

@ -3,6 +3,10 @@ package Testa is
type TestCase is tagged private;
type Test_Method_Type is access procedure (T : in out TestCase);
procedure Set_Method (T : in out TestCase;
M : in Test_Method_Type);
procedure Run (T : in out TestCase);
private
type TestCase is tagged record

View File

@ -4,22 +4,13 @@ with Ada.Text_IO;
use Ada.Text_IO;
package body WasRun is
procedure Run (T : in out WTestCase) is
begin
T.Method_To_Invoke (T);
end Run;
procedure Test_Method (T : in out WTestCase) is
begin
T.WasRun := True;
null;
-- T.WasRun := True;
end Test_Method;
procedure Set_Method (T : in out WTestCase;
M : in Test_Method_Type) is
begin
T.Method_To_Invoke := M;
end Set_Method;
procedure Print_WasRun(T : in WTestCase) is
begin
if T.WasRun then

View File

@ -2,22 +2,15 @@
with Testa;
package WasRun is
type WTestCase is tagged private;
type WTestCase is new Testa.TestCase with private;
procedure Run (T : in out WTestCase);
procedure Test_Method (T : in out WTestCase);
procedure Print_WasRun (T : in WTestCase);
type Test_Method_Type is access procedure (T : in out WTestCase);
procedure Set_Method (T : in out WTestCase;
M : in Test_Method_Type);
private
type WTestCase is new Testa.TestCase with record
WasRun : Boolean := False;
Method_To_Invoke : Test_Method_Type;
end record;
end WasRun;

View File

@ -7,7 +7,6 @@ use Ada.Text_IO;
procedure WasRun_Runner is
WasRunTest : WasRun.WTestCase;
begin
Put_Line ("Starting WasRun Runner");
WasRunTest.Set_Method (WasRun.Test_Method'Access);
WasRunTest.Print_WasRun;
WasRunTest.Run;