From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5312057f44240abb,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.31.165 with SMTP id b5mr21172104pbi.1.1323133963539; Mon, 05 Dec 2011 17:12:43 -0800 (PST) Path: lh20ni73937pbb.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!xlned.com!feeder1.xlned.com!newsreader4.netcologne.de!news.netcologne.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 06 Dec 2011 02:12:42 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: AUnit: access to local procedure needed when asserting exception Message-ID: <4edd6c0a$0$6581$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 06 Dec 2011 02:12:42 CET NNTP-Posting-Host: 9f0e3dff.newsspool3.arcor-online.net X-Trace: DXC=8GS\LcJog]XE47KDAk81NWMcF=Q^Z^V3X4Fo<]lROoRQ8kFejVXKU]GfNDIe[TW1g4Oa5bZU_ X-Complaints-To: usenet-abuse@arcor.de Xref: news2.google.com comp.lang.ada:14847 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: 2011-12-06T02:12:42+01:00 List-Id: In agreement with AUnit's docs, I wanted to write a test routine that tests for an exception being raised. To do so, I wrote a local procedure that would become a parameter of a generic procedure Assert_Exception. However, this generic is gone from AUnit (the one distributed with both GNAT GPL 2010 and 2011), and seems to have been replaced with a non-generic procedure that takes an object of pointer-to-procedure type instead. The pointer-to-procedure, type Throwing_Exception_Proc is access procedure; is defined at library level in AUnit.Assertions. Consequently, when seeing procedure Test_Null mostly reproduced below, the compiler diagnoses (correctly, I think) 66. AUnit.Assertions.Assert_Exception (Null_Raises'Access, | >>> subprogram must not be deeper than access type procedure Test_Null (Test : in out Test_Case'Class) is procedure Null_Raises is Position : Natural; begin Position := Find (Search_Test(Test).Buffer, Get_Null_Pattern, 1); end Null_Raises; --procedure Assert_Raises is -- new AUnit.Assertions.Assert_Exception (Null_Raises); begin AUnit.Assertions.Assert_Exception (Null_Raises'Access, "null string raises Pattern_Error"); end Test_Null; I should be able to write the tests differently, so that everything necessary for the test routine is declared at the same level as the pointer-to-procedure type requires. But why is the simpler generic gone? I also imagine that the authors of AUnit have had good reason to introduce a named type---preventing access to local procedures. Am I missing something? Georg