-
Notifications
You must be signed in to change notification settings - Fork 19
Combined and TRX reporters #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
|
|
||
| package body AUnit.Reporter.Combine is | ||
|
|
||
| procedure Report | ||
| (Engine : Combined_Reporter; | ||
| R : in out Result'Class; | ||
| Options : AUnit_Options := Default_Options) is | ||
|
|
||
| procedure Run_Reporter(Position : Reporter_Vecs.Cursor) is | ||
| Element : constant Reporter_Access := Reporter_Vecs.Element (Position); | ||
| begin | ||
| AUnit.Reporter.Report (Element.all, R, Options); | ||
| end Run_Reporter; | ||
| begin | ||
| Reporter_Vecs.Iterate (Engine.Reporters, Run_Reporter'Access); | ||
| end Report; | ||
|
|
||
| procedure Add_Reporter (C : in out Combined_Reporter; R : access constant Reporter'Class) is | ||
| begin | ||
| C.Reporters.Append(R); | ||
| end Add_Reporter; | ||
|
|
||
| end AUnit.Reporter.Combine; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| with Ada.Containers.Vectors; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't work for restricted runtimes, Ada.Containers are not present there
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there an easy way for me to test that? I tried adding
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After reviewing aunit_shared.gpr it seems clear this currently works fine. I guess the proper way to do this would be to add another enumeration like the current Except, Calend, Memory and FileIO and then create a consistent interface to the Vectors package with two implementations, "vectors" would pass through to Ada.Containers.Vectors, while "novectors" would have some custom implementation. Another option would be to use AUnit.Memory directly, or rather, to implement AUnit.Vectors in terms of AUnit.Memory, so that the above enumeration isn't necessay. Thoughts on which is better/simpler? By the way, I saw that in aunit_shared.gpr around line 52
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A third option I think is to move the trx reporter into a separate directory which is only included as a source when the runtime is set to full. This is the only option that doesn't have me unnecessarily supporting runtimes I don't use myself. |
||
|
|
||
| package AUnit.Reporter.Combine is | ||
|
|
||
| type Combined_Reporter is new Reporter with private; | ||
|
|
||
| overriding | ||
| procedure Report | ||
| (Engine : Combined_Reporter; | ||
| R : in out Result'Class; | ||
| Options : AUnit_Options := Default_Options); | ||
|
|
||
| procedure Add_Reporter (C : in out Combined_Reporter; R : access constant Reporter'Class); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. R should be of type Reporter_Access, otherwise there would be a compilation error: aunit-reporter-combine.adb:20:26: implicit conversion of anonymous access parameter not allowed |
||
|
|
||
| private | ||
|
|
||
| type Reporter_Access is access constant Reporter'Class; | ||
|
TamaMcGlinn marked this conversation as resolved.
|
||
|
|
||
| package Reporter_Vecs is new Ada.Containers.Vectors | ||
| (Element_Type => Reporter_Access, | ||
| Index_Type => Positive); | ||
|
|
||
| type Combined_Reporter is new Reporter with record | ||
| Reporters : Reporter_Vecs.Vector; | ||
| end record; | ||
| end AUnit.Reporter.Combine; | ||
Uh oh!
There was an error while loading. Please reload this page.