NAME
Test::Mini::Logger - Output Logger Base Class
DESCRIPTION
Whether you're using a tool that expects output in a certain format, or you just long for the familiar look and feel of another testing framework, this is what you're looking for.
METHODS
Attribute Accessors
- buffer
-
- buffer($self) # => IOOutput buffer.
Returns:
(IO) - Output buffer.
- verbose
-
- verbose($self) # => ObjectLogger verbosity.
Returns:
Logger verbosity.
Output Functions
-
- print($self, @msg) # => ObjectWrite output to the #buffer . Lines will be output without added newlines.
Parameters:
@msg- The message(s) to be printed; will be handled as perprint. - say
-
- say($self, @msg) # => ObjectWrite output to the #buffer . Lines will be output with appended newlines.
Parameters:
@msg- The message(s) to be printed; newlines will be appended to each message, before being passed to #print .
Callbacks
- begin_test
-
- begin_test($self, $tc, $test) # => ObjectCalled before each test is run.
Parameters:
$tc(Class) - The test case owning the test method.$test(String) - The name of the test method being run. - begin_test_case
-
- begin_test_case($self, $tc, @tests) # => ObjectCalled before each test case is run.
Parameters:
$tc(Class) - The test case being run.@tests(Array<String>) - A list of tests to be run. - begin_test_suite
-
- begin_test_suite($self, %args) # => ObjectCalled before the test suite is run.
Parameters:
%args(Hash) - Options the test suite was run with.Valid Options for
%args:filter (String) - Test name filter.
seed (String) - Randomness seed.
- error
-
- error($self, $tc, $test, $e) # => ObjectCalled when a test dies with an error. Increments the error count.
Parameters:
$tc(Class) - The test case owning the test method.$test(String) - The name of the test with an error.$e(Test::Mini::Exception) - The exception object. - fail
-
- fail($self, $tc, $test, $e) # => ObjectCalled when a test fails. Increments the failure count.
Parameters:
$tc(Class) - The test case owning the test method.$test(String) - The name of the failed test.$e(Test::Mini::Exception::Assert) - The exception object. - finish_test
-
- finish_test($self, $tc, $test, $assertions) # => ObjectCalled after each test is run. Increments the test and assertion counts, and finalizes the test's timing.
Parameters:
$tc(Class) - The test case owning the test method.$test(String) - The name of the test method just run.$assertions(Integer) - The number of assertions called. - finish_test_case
-
- finish_test_case($self, $tc, @tests) # => ObjectCalled after each test case is run. Increments the test case count, and finalizes the test case's timing.
Parameters:
$tc(Class) - The test case just run.@tests(Array<String>) - A list of tests run. - finish_test_suite
-
- finish_test_suite($self, $exit_code) # => ObjectCalled after each test suite is run. Finalizes the test suite timing.
Parameters:
$exit_code(Integer) - Status the tests finished with. - pass
-
- pass($self, $tc, $test) # => ObjectCalled when a test passes. Increments the pass count.
Parameters:
$tc(Class) - The test case owning the test method.$test(String) - The name of the passing test. - skip
-
- skip($self, $tc, $test, $e) # => ObjectCalled when a test is skipped. Increments the skip count.
Parameters:
$tc(Class) - The test case owning the test method.$test(String) - The name of the skipped test.$e(Test::Mini::Exception::Skip) - The exception object.
Statistics
- count
-
- count # => Hash - count($key) # => NumberAccessor for counters.
Overloads:
- count # => HashThe count hash.
Returns:
(Hash) - The count hash.
- count($key) # => NumberThe value for the given key.
Parameters:
$key- A key in the count hash.Returns:
(Number) - The value for the given key.
- time
-
- time($self, $key) # => NumberAccessor for the timing data.
Parameters:
$key- The key to look up timings for. Typical values are:Times for units that have not finished should not be relied upon.
Returns:
(Number) - The time taken by the given argument, in seconds.
Class Methods
- new
-
+ new($class, %args) # => ObjectConstructor.
Parameters:
%args(Hash) - Initial state for the new instance.Valid Options for
%args:verbose - Logger verbosity. Defaults to
0.buffer (IO) - Output buffer. Defaults to
STDOUT.