[m-rev.] Re: for review: add test case for duplicate instance declarations

Fergus Henderson fjh at cs.mu.OZ.AU
Thu May 17 18:21:13 AEST 2001


On 17-May-2001, Fergus Henderson <fjh at cs.mu.oz.au> wrote:
> tests/invalid/Mmakefile:
> tests/invalid/duplicate_instance_1.m:
> tests/invalid/duplicate_instance_2.m:
> tests/invalid/duplicate_instance_2.err_exp:
> tests/invalid/duplicate_instance_2.err_exp2:
> 	Add a test case to test that we report link errors for duplicate
> 	instance definitions.

Estimated hours taken: 0.25
Branches: main

tests/invalid/Mmakefile:
tests/invalid/duplicate_instance_2.err_exp3:
tests/invalid/duplicate_instance_2.err_exp4:
	Add some alternative error outputs for this test case;
	the output is quite different when intermodule optimization is enabled
	and is also slightly different when using lcc.

Workspace: /home/mars/fjh/ws1/mercury
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.86
diff -u -d -r1.86 Mmakefile
--- tests/invalid/Mmakefile	2001/05/16 17:28:43	1.86
+++ tests/invalid/Mmakefile	2001/05/17 07:49:15
@@ -181,14 +181,17 @@
 	then false; else true; fi
 
 # Some tests have more than one possible valid output, so
-# we allow the test to pass if it matches *either* the .err_exp
-# or the .err_exp2 file. 
+# we allow the test to pass if it matches any of the .err_exp* files.
 DIFF_OPTS=-c
 %.err_res: %.err %.err_exp
 	-rm -f $@
 	diff $(DIFF_OPTS) $*.err_exp $*.err > $@ || \
 		{ [ -f $*.err_exp2 ] && \
-		  diff $(DIFF_OPTS) $*.err_exp2 $*.err > $@; }
+		  diff $(DIFF_OPTS) $*.err_exp2 $*.err > $@; } || \
+		{ [ -f $*.err_exp3 ] && \
+		  diff $(DIFF_OPTS) $*.err_exp3 $*.err > $@; } || \
+		{ [ -f $*.err_exp4 ] && \
+		  diff $(DIFF_OPTS) $*.err_exp4 $*.err > $@; }
 
 all:	check
 
Index: tests/invalid/duplicate_instance_2.err_exp3
===================================================================
RCS file: duplicate_instance_2.err_exp3
diff -N duplicate_instance_2.err_exp3
--- /dev/null	Wed Apr 11 00:52:25 2001
+++ duplicate_instance_2.err_exp3	Thu May 17 17:38:28 2001
@@ -0,0 +1,3 @@
+duplicate_instance_1.opt:003: Error: multiply defined (or overlapping) instance
+duplicate_instance_1.opt:003: declarations for class `duplicate_instance_1:foo/1'.
+duplicate_instance_2.m:010: Previous instance declaration was here.
Index: tests/invalid/duplicate_instance_2.err_exp4
===================================================================
RCS file: duplicate_instance_2.err_exp4
diff -N duplicate_instance_2.err_exp4
--- /dev/null	Wed Apr 11 00:52:25 2001
+++ duplicate_instance_2.err_exp4	Thu May 17 17:48:35 2001
@@ -0,0 +1,10 @@
+lcc.orig: -lc ignored
+lcc.orig: -lgcc ignored
+lcc.orig: -lc ignored
+lcc.orig: -lgcc ignored
+lcc.orig: -lc ignored
+lcc.orig: -lgcc ignored
+duplicate_instance_2.o(.data+0x0): multiple definition of `<instance declaration for duplicate_instance_1:foo(int/0)>'
+duplicate_instance_1.o(.data+0x0): first defined here
+Error: system command returned non-zero exit status.
+Error: link failed.
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list