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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: AUnit question Date: Mon, 04 Aug 2014 16:52:05 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="c27d95ddf365c2aa748a7ec17a81943e"; logging-data="8834"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rfX7cQkKkc3UIKE0ruIzsyikQih2ijvk=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:b7GzLnQz1dceKQ9q6sN+e1SmJTE= sha1:RLU6UwamitXulbaCQss1M15K4UE= Xref: news.eternal-september.org comp.lang.ada:21443 Date: 2014-08-04T16:52:05+01:00 List-Id: Victor Porton writes: > In the below source every test requires an object of type World_Type. > > Wouldn't it better to move the `World: World_Type` object into the > test case object and not create it anew in every test procedure? > > But how to do this? Test functions receive Test_Cases.Test_Case'Class, > not my type of test case. Should I manually do type conversion in > every test function? or is there a better way? Manual type conversion would certainly work. But at the end of the test, the World object would be left in its changed state unless you reset it in Tear_Down (you'd maybe want to initialize it in Set_Up). If you were going to do that, you could get a similar effect by declaring the object globally (in the test package body).