Hello,
I'm attempting to follow along Kent Beck's book Test-Driven Development in creating a simple unit test framework. I've run into a problem with Procedure Types. I can't get my program to compile. When I comment out all of the stuff having to do with the Procedure Type I'm using, it will compile. Otherwise, I get this message:
tez@cibolo:~/Desktop/Modula-2/mtunit$ gm2 Test_Suite.mod
Test_Suite.mod:36:15: error: unimplemented identifier(s) in EXPORT list of DEFINITION MODULE Test_Suite
the implementation module fails to implement the following exported identifier(s)
36 | END Test_Suite.
|
I'm not sure what I'm doing wrong. I tried declaring my Procedure Type like so:
TYPE Run_Type = PROC;
TYP Run_Type = PROCEDURE ();
But none of those seem to work. I can't think of anything else to try. I'm using whatever version of the compiler that you currently get with the Debian package.
tez@cibolo:~/Desktop/Modula-2/mtunit$ gm2 -v
Using built-in specs.
COLLECT_GCC=gm2
COLLECT_LTO_WRAPPER=/usr/lib/gm2/libexec/gcc/x86_64-linux-gnu/10.2.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../configure --enable-languages=c,c++,m2 --prefix=/opt/gm2 --libexecdir=/usr/lib/gm2/libexec --infodir=/opt/gm2/share/info --mandir=/opt/gm2/share/man --enable-threads=posix --enable-clocale=gnu --disable-multilib --disable-bootstrap --enable-checking --build=x86_64-linux-gnu --host=x86_64-linux-gnu --enable-long-longx
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.1 20200915 (GCC)
tez@cibolo:~/Desktop/Modula-2/mtunit$ gm2 --version
gm2 (GCC) 10.2.1 20200915
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Any helpful hints would be appreciated. The code to both of my modules is listed below.
Thanks,
Derek
DEFINITION MODULE Test_Suite;
TYPE Test_Suite;
TYPE Run_Type;
PROCEDURE construct(VAR instance: Test_Suite; run_proc_instance: Run_Type);
PROCEDURE run(instance: Test_Suite);
END Test_Suite.
IMPLEMENTATION MODULE Test_Suite;
IMPORT Storage;
(* DECLARATIONS *********************************************************** *)
TYPE Run_Type = PROCEDURE;
TYPE Chronicle = RECORD
it_was_run: BOOLEAN;
run_proc: Run_Type;
END;
TYPE Test_Suite = POINTER TO Chronicle;
(* ------------------------------------------------------------------------ *)
PROCEDURE construct(VAR instance: Test_Suite; run_proc_instance: Run_Type);
VAR chronicle_instance : Chronicle;
BEGIN
Storage.ALLOCATE(instance, SIZE(Chronicle));
instance^ := chronicle_instance;
instance^.run_proc := run_proc_instance;
instance^.it_was_run := FALSE;
END construct;
(* ------------------------------------------------------------------------ *)
PROCEDURE run(instance: Test_Suite);
BEGIN
instance^.it_was_run := TRUE;
instance^.run_proc;
END run;
END Test_Suite.