comp.lang.ada
 help / color / mirror / Atom feed
From: Stephane Carrez <stephane.carrez@gmail.com>
Subject: Re: Is it possible to redirect text output to a String or Unbounded_String?
Date: Fri, 11 Jun 2021 06:07:11 -0700 (PDT)	[thread overview]
Message-ID: <9d0e2e43-a4a5-421c-843f-e03f4fd800e4n@googlegroups.com> (raw)
In-Reply-To: <s9sda9$rhm$1@gioia.aioe.org>

Hi!

Le jeudi 10 juin 2021 à 09:00:31 UTC+2, Dmitry A. Kazakov a écrit :
> On 2021-06-10 04:17, Jerry wrote: 
> > Is it possible to redirect text output to a String or Unbounded_String rather than to a file?
> From Ada.Text_IO? No you cannot, File_Type is not tagged. For a stream 
> you could.

Tero Koskinen has made an interesting implementation in Ahven for that.

Basically he redirects the standard output to a file for the execution of the unit test method.
The unit test method executes and can use the Ada.Text_IO without change.
After the unit test completion, it reads the file.

If I'm not wrong, have a look at the Ahven.Temporary_Output package:

https://hg.sr.ht/~tkoskine/ahven/browse/src/ahven-temporary_output.ads?rev=tip
https://hg.sr.ht/~tkoskine/ahven/browse/src/ahven-temporary_output.adb?rev=tip

Best regards,

Stephane

  reply	other threads:[~2021-06-11 13:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  2:17 Is it possible to redirect text output to a String or Unbounded_String? Jerry
2021-06-10  6:50 ` Simon Wright
2021-06-10  7:00 ` Dmitry A. Kazakov
2021-06-11 13:07   ` Stephane Carrez [this message]
2021-06-10  8:31 ` ytomino
2021-06-10  9:09 ` Jeffrey R. Carter
2021-06-10 14:42 ` Stéphane Rivière
2021-06-11  6:51   ` Stéphane Rivière
2021-06-10 17:06 ` Marius Amado-Alves
2021-06-10 21:12 ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox