1-- 2-- Copyright (c) 2008 Tero Koskinen <tero.koskinen@iki.fi> 3-- 4-- Permission to use, copy, modify, and distribute this software for any 5-- purpose with or without fee is hereby granted, provided that the above 6-- copyright notice and this permission notice appear in all copies. 7-- 8-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15-- 16 17with Ahven.Framework; 18with Ahven.Name_List; 19 20-- A package for handling command line parameters 21-- 22-- Parameters are handled for normal and TAP test runners 23-- and the used mode is specified by giving either 24-- NORMAL_PARAMETERS or TAP_PARAMETERS parameter to 25-- Parse_Parameters procedure. 26package Ahven.Parameters is 27 28 Invalid_Parameter : exception; 29 30 type Parameter_Info is private; 31 32 type Parameter_Mode is (NORMAL_PARAMETERS, TAP_PARAMETERS); 33 34 procedure Parse_Parameters (Mode : Parameter_Mode; 35 Info : out Parameter_Info); 36 -- Parse Ada.Command_Line parameters and put the results 37 -- to the Info parameter. Raises Invalid_Parameter if 38 -- some parameter is invalid. 39 40 procedure Usage (Mode : Parameter_Mode := NORMAL_PARAMETERS); 41 -- Print usage. 42 43 function Capture (Info : Parameter_Info) return Boolean; 44 -- Capture Ada.Text_IO output? 45 46 function Verbose (Info : Parameter_Info) return Boolean; 47 -- Use verbose mode? 48 49 function XML_Results (Info : Parameter_Info) return Boolean; 50 -- Output XML? 51 52 function Single_Test (Info : Parameter_Info) return Boolean; 53 -- Run a single test (case/suite/routine) only? 54 55 function Test_Name (Info : Parameter_Info) return String; 56 -- Return the name of the test passed as a parameter. 57 58 function Test_Names (Info : Parameter_Info) 59 return Ahven.Name_List.List; 60 -- Return all the test names passed as a parameter 61 62 function Result_Dir (Info : Parameter_Info) return String; 63 -- Return the directory for XML results. 64 65 function Timeout (Info : Parameter_Info) return Framework.Test_Duration; 66 -- Return the timeout value for a test. 67 68 function Test_Class_Suffix (Info : Parameter_Info) return String; 69 70private 71 type Parameter_Info is record 72 Verbose_Output : Boolean := True; 73 Xml_Output : Boolean := False; 74 Capture_Output : Boolean := False; 75 76 Test_Names : Name_List.List; 77 -- Names of the wanted tests 78 79 Result_Dir : Natural := 0; 80 -- Position of results dir in the argument array 81 82 Test_Suffix : Natural := 0; 83 -- Position of test class name suffix in the argument array 84 85 Timeout : Framework.Test_Duration := 0.0; 86 end record; 87end Ahven.Parameters; 88