NAME
Venus::Test - Test Class
ABSTRACT
Test Class for Perl 5
SYNOPSIS
package
main;
use
Venus::Test;
my
$test
= Venus::Test->new(
't/Venus_Test.t'
);
# $test->for('name');
# $test->for('tagline');
# $test->for('abstract');
# $test->for('synopsis');
# $test->done;
DESCRIPTION
This package aims to provide a standard for documenting Venus derived software projects, a framework writing tests, test automation, and documentation generation.
ATTRIBUTES
This package has the following attributes:
file
file(string
$data
) (string)
The file attribute is read-write, accepts (string)
values, and is required.
Since 3.55
INHERITS
This package inherits behaviors from:
INTEGRATES
This package integrates behaviors from:
FUNCTIONS
This package provides the following functions:
test
test(string
$file
) (Venus::Test)
The test function is exported automatically and returns a Venus::Test object for the test file given.
Since 0.09
METHODS
This package provides the following methods:
collect
collect(string
$name
, any
@args
) (any)
The collect method dispatches to the collect_data_for_${name}
method indictated by the first argument and returns the result. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
collect_data_for_abstract
collect_data_for_abstract() (arrayref)
The collect_data_for_abstract method uses "data" to fetch data for the abstract
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_abstract example 1
-
# =abstract
#
# Example Test Documentation
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_abstract
=
$test
->collect_data_for_abstract;
# ["Example Test Documentation"]
- collect_data_for_abstract example 2
-
# =abstract
#
# Example Test Documentation
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_abstract
) =
$test
->collect_data_for_abstract;
# "Example Test Documentation"
collect_data_for_attribute
collect_data_for_attribute(string
$name
) (arrayref)
The collect_data_for_attribute method uses "data" to fetch data for the attribute $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_attribute example 1
-
# =attribute name
#
# The name attribute is read-write, optional, and holds a string.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_attribute
=
$test
->collect_data_for_attribute(
'name'
);
# ["The name attribute is read-write, optional, and holds a string."]
- collect_data_for_attribute example 2
-
# =attribute name
#
# The name attribute is read-write, optional, and holds a string.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_attribute
) =
$test
->collect_data_for_attribute(
'name'
);
# "The name attribute is read-write, optional, and holds a string."
collect_data_for_authors
collect_data_for_authors() (arrayref)
The collect_data_for_authors method uses "data" to fetch data for the authors
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
-
# =authors
#
# Awncorp, C<awncorp@cpan.org>
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_authors
=
$test
->collect_data_for_authors;
# ["Awncorp, C<awncorp@cpan.org>"]
-
# =authors
#
# Awncorp, C<awncorp@cpan.org>
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_authors
) =
$test
->collect_data_for_authors;
# "Awncorp, C<awncorp@cpan.org>"
collect_data_for_description
collect_data_for_description() (arrayref)
The collect_data_for_description method uses "data" to fetch data for the description
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_description example 1
-
# =description
#
# This package provides an example class.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_description
=
$test
->collect_data_for_description;
# ["This package provides an example class."]
- collect_data_for_description example 2
-
# =description
#
# This package provides an example class.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_description
) =
$test
->collect_data_for_description;
# "This package provides an example class."
collect_data_for_encoding
collect_data_for_encoding() (arrayref)
The collect_data_for_encoding method uses "data" to fetch data for the encoding
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_encoding example 1
-
# =encoding
#
# utf8
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_encoding
=
$test
->collect_data_for_encoding;
# ["UTF8"]
- collect_data_for_encoding example 2
-
# =encoding
#
# utf8
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_encoding
) =
$test
->collect_data_for_encoding;
# "UTF8"
collect_data_for_error
collect_data_for_error(string
$name
) (arrayref)
The collect_data_for_error method uses "data" to fetch data for the error $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_error example 1
-
# =error error_on_unknown
#
# This package may raise an error_on_unknown error.
#
# =cut
#
# =example-1 error_on_unknown
#
# # given: synopsis
#
# my $error = $example->catch('error', {
# with => 'error_on_unknown',
# });
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_error
=
$test
->collect_data_for_error(
'error_on_unknown'
);
# ["This package may raise an error_on_unknown error."]
- collect_data_for_error example 2
-
# =error error_on_unknown
#
# This package may raise an error_on_unknown error.
#
# =cut
#
# =example-1 error_on_unknown
#
# # given: synopsis
#
# my $error = $example->catch('error', {
# with => 'error_on_unknown',
# });
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_error
) =
$test
->collect_data_for_error(
'error_on_unknown'
);
# "This package may raise an error_on_unknown error."
collect_data_for_example
collect_data_for_example(number
$numberm
string
$name
) (arrayref)
The collect_data_for_example method uses "data" to fetch data for the example-$number $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_example example 1
-
# =attribute name
#
# The name attribute is read-write, optional, and holds a string.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_example
=
$test
->collect_data_for_example(1,
'name'
);
# [' # given: synopsis', ' my $name = $example->name;', ' # "..."']
- collect_data_for_example example 2
-
# =attribute name
#
# The name attribute is read-write, optional, and holds a string.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
@collect_data_for_example
=
$test
->collect_data_for_example(1,
'name'
);
# (' # given: synopsis', ' my $name = $example->name;', ' # "..."')
collect_data_for_feature
collect_data_for_feature(string
$name
) (arrayref)
The collect_data_for_feature method uses "data" to fetch data for the feature $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_feature example 1
-
# =feature noop
#
# This package is no particularly useful features.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_feature
=
$test
->collect_data_for_feature(
'noop'
);
# ["This package is no particularly useful features."]
- collect_data_for_feature example 2
-
# =feature noop
#
# This package is no particularly useful features.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_feature
) =
$test
->collect_data_for_feature(
'noop'
);
# "This package is no particularly useful features."
collect_data_for_function
collect_data_for_function(string
$name
) (arrayref)
The collect_data_for_function method uses "data" to fetch data for the function $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_function example 1
-
# =function eg
#
# The eg function returns a new instance of Example.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $example = eg();
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_function
=
$test
->collect_data_for_function(
'eg'
);
# ["The eg function returns a new instance of Example."]
- collect_data_for_function example 2
-
# =function eg
#
# The eg function returns a new instance of Example.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $example = eg();
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_function
) =
$test
->collect_data_for_function(
'eg'
);
# "The eg function returns a new instance of Example."
collect_data_for_includes
collect_data_for_includes() (arrayref)
The collect_data_for_includes method uses "data" to fetch data for the includes
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_includes example 1
-
# =includes
#
# function: eg
#
# method: prepare
# method: execute
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_includes
=
$test
->collect_data_for_includes;
# ["function: eg", "method: prepare", "method: execute"]
- collect_data_for_includes example 2
-
# =includes
#
# function: eg
#
# method: prepare
# method: execute
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
@collect_data_for_includes
=
$test
->collect_data_for_includes;
# ("function: eg", "method: prepare", "method: execute")
collect_data_for_inherits
collect_data_for_inherits() (arrayref)
The collect_data_for_inherits method uses "data" to fetch data for the inherits
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_inherits example 1
-
# =inherits
#
# Venus::Core::Class
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_inherits
=
$test
->collect_data_for_inherits;
# ["Venus::Core::Class"]
- collect_data_for_inherits example 2
-
# =inherits
#
# Venus::Core::Class
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_inherits
) =
$test
->collect_data_for_inherits;
# "Venus::Core::Class"
collect_data_for_integrates
collect_data_for_integrates() (arrayref)
The collect_data_for_integrates method uses "data" to fetch data for the integrates
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_integrates example 1
-
# =integrates
#
# Venus::Role::Catchable
# Venus::Role::Throwable
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_integrates
=
$test
->collect_data_for_integrates;
# ["Venus::Role::Catchable\nVenus::Role::Throwable"]
- collect_data_for_integrates example 2
-
# =integrates
#
# Venus::Role::Catchable
# Venus::Role::Throwable
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_integrates
) =
$test
->collect_data_for_integrates;
# "Venus::Role::Catchable\nVenus::Role::Throwable"
collect_data_for_layout
collect_data_for_layout() (arrayref)
The collect_data_for_layout method uses "data" to fetch data for the layout
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_layout example 1
-
# =layout
#
# encoding
# name
# synopsis
# description
# attributes: attribute
# authors
# license
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_layout
=
$test
->collect_data_for_layout;
# ["encoding\nname\nsynopsis\ndescription\nattributes: attribute\nauthors\nlicense"]
- collect_data_for_layout example 2
-
# =layout
#
# encoding
# name
# synopsis
# description
# attributes: attribute
# authors
# license
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_layout
) =
$test
->collect_data_for_layout;
# "encoding\nname\nsynopsis\ndescription\nattributes: attribute\nauthors\nlicense"
collect_data_for_libraries
collect_data_for_libraries() (arrayref)
The collect_data_for_libraries method uses "data" to fetch data for the libraries
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_libraries example 1
-
# =libraries
#
# Venus::Check
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_libraries
=
$test
->collect_data_for_libraries;
# ["Venus::Check"]
- collect_data_for_libraries example 2
-
# =libraries
#
# Venus::Check
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_libraries
) =
$test
->collect_data_for_libraries;
# "Venus::Check"
collect_data_for_license
collect_data_for_license() (arrayref)
The collect_data_for_license method uses "data" to fetch data for the license
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_license example 1
-
# =license
#
# No license granted.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_license
=
$test
->collect_data_for_license;
# ["No license granted."]
- collect_data_for_license example 2
-
# =license
#
# No license granted.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_license
) =
$test
->collect_data_for_license;
# "No license granted."
collect_data_for_message
collect_data_for_message(string
$name
) (arrayref)
The collect_data_for_message method uses "data" to fetch data for the message $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_message example 1
-
# =message accept
#
# The accept message represents acceptance.
#
# =cut
#
# =example-1 accept
#
# # given: synopsis
#
# my $accept = $example->accept;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_message
=
$test
->collect_data_for_message(
'accept'
);
# ["The accept message represents acceptance."]
- collect_data_for_message example 2
-
# =message accept
#
# The accept message represents acceptance.
#
# =cut
#
# =example-1 accept
#
# # given: synopsis
#
# my $accept = $example->accept;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_message
) =
$test
->collect_data_for_message(
'accept'
);
# "The accept message represents acceptance."
collect_data_for_metadata
collect_data_for_metadata(string
$name
) (arrayref)
The collect_data_for_metadata method uses "data" to fetch data for the metadata $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_metadata example 1
-
# =method prepare
#
# The prepare method prepares for execution.
#
# =cut
#
# =metadata prepare
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 prepare
#
# # given: synopsis
#
# my $prepare = $example->prepare;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_metadata
=
$test
->collect_data_for_metadata(
'prepare'
);
# ["{since => 1.2.3}"]
- collect_data_for_metadata example 2
-
# =method prepare
#
# The prepare method prepares for execution.
#
# =cut
#
# =metadata prepare
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 prepare
#
# # given: synopsis
#
# my $prepare = $example->prepare;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_metadata
) =
$test
->collect_data_for_metadata(
'prepare'
);
# "{since => 1.2.3}"
collect_data_for_method
collect_data_for_method(string
$name
) (arrayref)
The collect_data_for_method method uses "data" to fetch data for the method $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_method example 1
-
# =method execute
#
# The execute method executes the logic.
#
# =cut
#
# =metadata execute
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 execute
#
# # given: synopsis
#
# my $execute = $example->execute;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_method
=
$test
->collect_data_for_method(
'execute'
);
# ["The execute method executes the logic."]
- collect_data_for_method example 2
-
# =method execute
#
# The execute method executes the logic.
#
# =cut
#
# =metadata execute
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 execute
#
# # given: synopsis
#
# my $execute = $example->execute;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_method
) =
$test
->collect_data_for_method(
'execute'
);
# "The execute method executes the logic."
collect_data_for_name
collect_data_for_name() (arrayref)
The collect_data_for_name method uses "data" to fetch data for the name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_name example 1
-
# =name
# Example
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_name
=
$test
->collect_data_for_name;
# ["Example"]
- collect_data_for_name example 2
-
# =name
# Example
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_name
) =
$test
->collect_data_for_name;
# "Example"
collect_data_for_operator
collect_data_for_operator(string
$name
) (arrayref)
The collect_data_for_operator method uses "data" to fetch data for the operator $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_operator example 1
-
# =operator ("")
#
# This package overloads the C<""> operator.
#
# =cut
#
# =example-1 ("")
#
# # given: synopsis
#
# my $string = "$example";
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_operator
=
$test
->collect_data_for_operator(
'("")'
);
# ['This package overloads the C<""> operator.']
- collect_data_for_operator example 2
-
# =operator ("")
#
# This package overloads the C<""> operator.
#
# =cut
#
# =example-1 ("")
#
# # given: synopsis
#
# my $string = "$example";
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_operator
) =
$test
->collect_data_for_operator(
'("")'
);
# 'This package overloads the C<""> operator.'
collect_data_for_partials
collect_data_for_partials() (arrayref)
The collect_data_for_partials method uses "data" to fetch data for the partials
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_partials example 1
-
# =partials
#
# t/path/to/other.t: present: authors
# t/path/to/other.t: present: license
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_partials
=
$test
->collect_data_for_partials;
# ["t/path/to/other.t: present: authors\nt/path/to/other.t: present: license"]
- collect_data_for_partials example 2
-
# =partials
#
# t/path/to/other.t: present: authors
# t/path/to/other.t: present: license
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_partials
) =
$test
->collect_data_for_partials;
# "t/path/to/other.t: present: authors\nt/path/to/other.t: present: license"
collect_data_for_project
collect_data_for_project() (arrayref)
The collect_data_for_project method uses "data" to fetch data for the project
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_project example 1
-
# =project
#
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_project
=
$test
->collect_data_for_project;
- collect_data_for_project example 2
-
# =project
#
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_project
) =
$test
->collect_data_for_project;
collect_data_for_signature
collect_data_for_signature(string
$name
) (arrayref)
The collect_data_for_signature method uses "data" to fetch data for the signature $name
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_signature example 1
-
# =method execute
#
# The execute method executes the logic.
#
# =cut
#
# =signature execute
#
# execute() (boolean)
#
# =cut
#
# =metadata execute
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 execute
#
# # given: synopsis
#
# my $execute = $example->execute;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_signature
=
$test
->collect_data_for_signature(
'execute'
);
# [" execute() (boolean)"]
- collect_data_for_signature example 2
-
# =method execute
#
# The execute method executes the logic.
#
# =cut
#
# =signature execute
#
# execute() (boolean)
#
# =cut
#
# =metadata execute
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 execute
#
# # given: synopsis
#
# my $execute = $example->execute;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_signature
) =
$test
->collect_data_for_signature(
'execute'
);
# " execute() (boolean)"
collect_data_for_synopsis
collect_data_for_synopsis() (arrayref)
The collect_data_for_synopsis method uses "data" to fetch data for the synopsis
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_synopsis example 1
-
# =synopsis
#
# use Example;
#
# my $example = Example->new;
#
# # bless(..., "Example")
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_synopsis
=
$test
->collect_data_for_synopsis;
# [' use Example;', ' my $example = Example->new;', ' # bless(..., "Example")']
- collect_data_for_synopsis example 2
-
# =synopsis
#
# use Example;
#
# my $example = Example->new;
#
# # bless(..., "Example")
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
@collect_data_for_synopsis
=
$test
->collect_data_for_synopsis;
# (' use Example;', ' my $example = Example->new;', ' # bless(..., "Example")')
collect_data_for_tagline
collect_data_for_tagline() (arrayref)
The collect_data_for_tagline method uses "data" to fetch data for the tagline
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_tagline example 1
-
# =tagline
#
# Example Class
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_tagline
=
$test
->collect_data_for_tagline;
# ["Example Class"]
- collect_data_for_tagline example 2
-
# =tagline
#
# Example Class
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_tagline
) =
$test
->collect_data_for_tagline;
# "Example Class"
collect_data_for_version
collect_data_for_version() (arrayref)
The collect_data_for_version method uses "data" to fetch data for the version
section and returns the data. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- collect_data_for_version example 1
-
# =version
#
# 1.2.3
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$collect_data_for_version
=
$test
->collect_data_for_version;
# ["1.2.3"]
- collect_data_for_version example 2
-
# =version
#
# 1.2.3
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
(
$collect_data_for_version
) =
$test
->collect_data_for_version;
# "1.2.3"
data
data() (Venus::Data)
The data method returns a Venus::Data object using "file" for parsing the test specification.
Since 3.55
done
done() (any)
The done method dispatches to the "done_testing" in Test::More operation and returns the result.
Since 3.55
execute
execute(string
$name
, any
@args
) (boolean)
The execute method dispatches to the execute_data_for_${name}
method indictated by the first argument and returns the result. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- execute example 2
-
# given: synopsis
package
main;
my
$execute
=
$test
->execute(
'name'
,
sub
{
my
(
$data
) =
@_
;
my
$result
=
$data
->[0] eq
'Venus::Test'
? true : false;
$self
->pass(
$result
,
'name set as Venus::Test'
);
return
$result
;
});
# true
execute_test_for_abstract
execute_test_for_abstract() (arrayref)
The execute_test_for_abstract method tests a documentation block for the abstract
section and returns the result.
Since 3.55
- execute_test_for_abstract example 1
-
# =abstract
#
# Example Test Documentation
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_abstract
=
$test
->execute_test_for_abstract;
# true
execute_test_for_attribute
execute_test_for_attribute(string
$name
) (arrayref)
The execute_test_for_attribute method tests a documentation block for the attribute $name
section and returns the result.
Since 3.55
- execute_test_for_attribute example 1
-
# =attribute name
#
# The name attribute is read-write, optional, and holds a string.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_attribute
=
$test
->execute_test_for_attribute(
'name'
);
# true
execute_test_for_authors
execute_test_for_authors() (arrayref)
The execute_test_for_authors method tests a documentation block for the authors
section and returns the result.
Since 3.55
-
# =authors
#
# Awncorp, C<awncorp@cpan.org>
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_authors
=
$test
->execute_test_for_authors;
# true
execute_test_for_description
execute_test_for_description() (arrayref)
The execute_test_for_description method tests a documentation block for the description
section and returns the result.
Since 3.55
- execute_test_for_description example 1
-
# =description
#
# This package provides an example class.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_description
=
$test
->execute_test_for_description;
# true
execute_test_for_encoding
execute_test_for_encoding() (arrayref)
The execute_test_for_encoding method tests a documentation block for the encoding
section and returns the result.
Since 3.55
- execute_test_for_encoding example 1
-
# =encoding
#
# utf8
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_encoding
=
$test
->execute_test_for_encoding;
# true
execute_test_for_error
execute_test_for_error(string
$name
) (arrayref)
The execute_test_for_error method tests a documentation block for the error $name
section and returns the result.
Since 3.55
- execute_test_for_error example 1
-
# =error error_on_unknown
#
# This package may raise an error_on_unknown error.
#
# =cut
#
# =example-1 error_on_unknown
#
# # given: synopsis
#
# my $error = $example->catch('error', {
# with => 'error_on_unknown',
# });
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_error
=
$test
->execute_test_for_error(
'error_on_unknown'
);
# true
execute_test_for_example
execute_test_for_example(number
$numberm
string
$name
) (arrayref)
The execute_test_for_example method tests a documentation block for the example-$number $name
section and returns the result.
Since 3.55
- execute_test_for_example example 1
-
# =attribute name
#
# The name attribute is read-write, optional, and holds a string.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_example
=
$test
->execute_test_for_example(1,
'name'
);
# true
execute_test_for_feature
execute_test_for_feature(string
$name
) (arrayref)
The execute_test_for_feature method tests a documentation block for the feature $name
section and returns the result.
Since 3.55
- execute_test_for_feature example 1
-
# =feature noop
#
# This package is no particularly useful features.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_feature
=
$test
->execute_test_for_feature(
'noop'
);
# true
execute_test_for_function
execute_test_for_function(string
$name
) (arrayref)
The execute_test_for_function method tests a documentation block for the function $name
section and returns the result.
Since 3.55
- execute_test_for_function example 1
-
# =function eg
#
# The eg function returns a new instance of Example.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $example = eg();
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_function
=
$test
->execute_test_for_function(
'eg'
);
# true
execute_test_for_includes
execute_test_for_includes() (arrayref)
The execute_test_for_includes method tests a documentation block for the includes
section and returns the result.
Since 3.55
- execute_test_for_includes example 1
-
# =includes
#
# function: eg
#
# method: prepare
# method: execute
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_includes
=
$test
->execute_test_for_includes;
# true
execute_test_for_inherits
execute_test_for_inherits() (arrayref)
The execute_test_for_inherits method tests a documentation block for the inherits
section and returns the result.
Since 3.55
- execute_test_for_inherits example 1
-
# =inherits
#
# Venus::Core::Class
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_inherits
=
$test
->execute_test_for_inherits;
# true
execute_test_for_integrates
execute_test_for_integrates() (arrayref)
The execute_test_for_integrates method tests a documentation block for the integrates
section and returns the result.
Since 3.55
- execute_test_for_integrates example 1
-
# =integrates
#
# Venus::Role::Catchable
# Venus::Role::Throwable
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_integrates
=
$test
->execute_test_for_integrates;
# true
execute_test_for_layout
execute_test_for_layout() (arrayref)
The execute_test_for_layout method tests a documentation block for the layout
section and returns the result.
Since 3.55
- execute_test_for_layout example 1
-
# =layout
#
# encoding
# name
# synopsis
# description
# attributes: attribute
# authors
# license
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_layout
=
$test
->execute_test_for_layout;
# true
execute_test_for_libraries
execute_test_for_libraries() (arrayref)
The execute_test_for_libraries method tests a documentation block for the libraries
section and returns the result.
Since 3.55
- execute_test_for_libraries example 1
-
# =libraries
#
# Venus::Check
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_libraries
=
$test
->execute_test_for_libraries;
# true
execute_test_for_license
execute_test_for_license() (arrayref)
The execute_test_for_license method tests a documentation block for the license
section and returns the result.
Since 3.55
- execute_test_for_license example 1
-
# =license
#
# No license granted.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_license
=
$test
->execute_test_for_license;
# true
execute_test_for_message
execute_test_for_message(string
$name
) (arrayref)
The execute_test_for_message method tests a documentation block for the message $name
section and returns the result.
Since 3.55
- execute_test_for_message example 1
-
# =message accept
#
# The accept message represents acceptance.
#
# =cut
#
# =example-1 accept
#
# # given: synopsis
#
# my $accept = $example->accept;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_message
=
$test
->execute_test_for_message(
'accept'
);
# true
execute_test_for_metadata
execute_test_for_metadata(string
$name
) (arrayref)
The execute_test_for_metadata method tests a documentation block for the metadata $name
section and returns the result.
Since 3.55
- execute_test_for_metadata example 1
-
# =method prepare
#
# The prepare method prepares for execution.
#
# =cut
#
# =metadata prepare
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 prepare
#
# # given: synopsis
#
# my $prepare = $example->prepare;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_metadata
=
$test
->execute_test_for_metadata(
'prepare'
);
# true
execute_test_for_method
execute_test_for_method(string
$name
) (arrayref)
The execute_test_for_method method tests a documentation block for the method $name
section and returns the result.
Since 3.55
- execute_test_for_method example 1
-
# =method execute
#
# The execute method executes the logic.
#
# =cut
#
# =metadata execute
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 execute
#
# # given: synopsis
#
# my $execute = $example->execute;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_method
=
$test
->execute_test_for_method(
'execute'
);
# true
execute_test_for_name
execute_test_for_name() (arrayref)
The execute_test_for_name method tests a documentation block for the name
section and returns the result.
Since 3.55
- execute_test_for_name example 1
-
# =name
# Example
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_name
=
$test
->execute_test_for_name;
# true
execute_test_for_operator
execute_test_for_operator(string
$name
) (arrayref)
The execute_test_for_operator method tests a documentation block for the operator $name
section and returns the result.
Since 3.55
- execute_test_for_operator example 1
-
# =operator ("")
#
# This package overloads the C<""> operator.
#
# =cut
#
# =example-1 ("")
#
# # given: synopsis
#
# my $string = "$example";
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$execute_test_for_operator
=
$test
->execute_test_for_operator(
'("")'
);
# true
explain
explain(any
@args
) (any)
The explain method dispatches to the "explain" in Test::More operation and returns the result.
Since 3.55
fail
fail(any
$data
, string
$description
) (any)
The fail method dispatches to the "ok" in Test::More operation expecting the first argument to be falsy and returns the result.
Since 3.55
for
for
(any
@args
) (Venus::Test)
The for method dispatches to the "execute" method using the arguments provided within a subtest and returns the invocant.
Since 3.55
- for example 3
-
# given: synopsis
package
main;
my
$for
=
$test
->
for
(
'synopsis'
,
sub
{
my
(
$tryable
) =
@_
;
return
$tryable
->result;
});
# bless(..., "Venus::Test")
- for example 4
-
# given: synopsis
package
main;
my
$for
=
$test
->
for
(
'example'
, 1,
'test'
,
sub
{
my
(
$tryable
) =
@_
;
return
$tryable
->result;
});
# bless(..., "Venus::Test")
like
like(string
$data
, string | Venus::Regexp
$match
, string
$description
) (any)
The like method dispatches to the "like" in Test::More operation and returns the result.
Since 3.55
- like example 1
-
# given: synopsis
package
main;
my
$like
=
$test
->like(
'hello world'
,
'world'
,
'example-1 like passed'
);
# true
- like example 2
-
# given: synopsis
package
main;
my
$like
=
$test
->like(
'hello world'
,
qr/world/
,
'example-1 like passed'
);
# true
more
more(any
@args
) (Venus::Test)
The more method dispatches to the Test::More method specified by the first argument and returns its result.
Since 3.55
okay
okay(any
$data
, string
$description
) (any)
The okay method dispatches to the "ok" in Test::More operation and returns the result.
Since 3.55
okay_can
okay_can(string
$name
, string
@args
) (any)
The okay_can method dispatches to the "can_ok" in Test::More operation and returns the result.
Since 3.55
okay_isa
okay_isa(string
$name
, string
$base
) (any)
The okay_isa method dispatches to the "isa_ok" in Test::More operation and returns the result.
Since 3.55
pass
pass(any
$data
, string
$description
) (any)
The pass method dispatches to the "ok" in Test::More operation expecting the first argument to be truthy and returns the result.
Since 3.55
perform
perform(string
$name
, any
@args
) (boolean)
The perform method dispatches to the perform_data_for_${name}
method indictated by the first argument and returns the result. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- perform example 1
-
# given: synopsis
package
main;
my
$data
=
$test
->collect(
'name'
);
my
$perform
=
$test
->perform(
'name'
,
$data
);
# true
perform_test_for_abstract
perform_test_for_abstract(arrayref
$data
) (boolean)
The perform_data_for_abstract method performs an overridable test for the abstract
section and returns truthy or falsy.
Since 3.55
- perform_test_for_abstract example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_abstract {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=abstract content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_abstract;
my
$perform_test_for_abstract
=
$test
->perform_test_for_abstract(
$data
,
);
# true
perform_test_for_attribute
perform_test_for_attribute(string
$name
, arrayref
$data
) (boolean)
The perform_data_for_attribute method performs an overridable test for the attribute $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_attribute example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_attribute {
my
(
$self
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=attribute $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_attribute(
'name'
);
my
$perform_test_for_attribute
=
$test
->perform_test_for_attribute(
'name'
,
$data
,
);
# true
perform_test_for_authors
perform_test_for_authors(arrayref
$data
) (boolean)
The perform_data_for_authors method performs an overridable test for the authors
section and returns truthy or falsy.
Since 3.55
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_authors {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=authors content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_authors;
my
$perform_test_for_authors
=
$test
->perform_test_for_authors(
$data
,
);
# true
perform_test_for_description
perform_test_for_description(arrayref
$data
) (boolean)
The perform_data_for_description method performs an overridable test for the description
section and returns truthy or falsy.
Since 3.55
- perform_test_for_description example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_description {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=description content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_description;
my
$perform_test_for_description
=
$test
->perform_test_for_description(
$data
,
);
# true
perform_test_for_encoding
perform_test_for_encoding(arrayref
$data
) (boolean)
The perform_data_for_encoding method performs an overridable test for the encoding
section and returns truthy or falsy.
Since 3.55
- perform_test_for_encoding example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_encoding {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=encoding content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_encoding;
my
$perform_test_for_encoding
=
$test
->perform_test_for_encoding(
$data
,
);
# true
perform_test_for_error
perform_test_for_error(arrayref
$data
) (boolean)
The perform_data_for_error method performs an overridable test for the error $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_error example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_error {
my
(
$self
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=error $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_error(
'error_on_unknown'
);
my
$perform_test_for_error
=
$test
->perform_test_for_error(
'error_on_unknown'
,
$data
,
);
# true
perform_test_for_example
perform_test_for_example(arrayref
$data
) (boolean)
The perform_data_for_example method performs an overridable test for the example-$number $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_example example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_example {
my
(
$self
,
$number
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=example-$number $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_example(1,
'execute'
);
my
$perform_test_for_example
=
$test
->perform_test_for_example(
1,
'execute'
,
$data
,
);
# true
perform_test_for_feature
perform_test_for_feature(arrayref
$data
) (boolean)
The perform_data_for_feature method performs an overridable test for the feature $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_feature example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_feature {
my
(
$self
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=feature $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_feature(
'noop'
);
my
$perform_test_for_feature
=
$test
->perform_test_for_feature(
'noop'
,
$data
,
);
# true
perform_test_for_function
perform_test_for_function(arrayref
$data
) (boolean)
The perform_data_for_function method performs an overridable test for the function $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_function example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_function {
my
(
$self
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=function $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_function(
'eg'
);
my
$perform_test_for_function
=
$test
->perform_test_for_function(
'eg'
,
$data
,
);
# true
perform_test_for_includes
perform_test_for_includes(arrayref
$data
) (boolean)
The perform_data_for_includes method performs an overridable test for the includes
section and returns truthy or falsy.
Since 3.55
- perform_test_for_includes example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_includes {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=includes content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_includes;
my
$perform_test_for_includes
=
$test
->perform_test_for_includes(
$data
,
);
# true
perform_test_for_inherits
perform_test_for_inherits(arrayref
$data
) (boolean)
The perform_data_for_inherits method performs an overridable test for the inherits
section and returns truthy or falsy.
Since 3.55
- perform_test_for_inherits example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_inherits {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=inherits content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_inherits;
my
$perform_test_for_inherits
=
$test
->perform_test_for_inherits(
$data
,
);
# true
perform_test_for_integrates
perform_test_for_integrates(arrayref
$data
) (boolean)
The perform_data_for_integrates method performs an overridable test for the integrates
section and returns truthy or falsy.
Since 3.55
- perform_test_for_integrates example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_integrates {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=integrates content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_integrates;
my
$perform_test_for_integrates
=
$test
->perform_test_for_integrates(
$data
,
);
# true
perform_test_for_layout
perform_test_for_layout(arrayref
$data
) (boolean)
The perform_data_for_layout method performs an overridable test for the layout
section and returns truthy or falsy.
Since 3.55
- perform_test_for_layout example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_layout {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=layout content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_layout;
my
$perform_test_for_layout
=
$test
->perform_test_for_layout(
$data
,
);
# true
perform_test_for_libraries
perform_test_for_libraries(arrayref
$data
) (boolean)
The perform_data_for_libraries method performs an overridable test for the libraries
section and returns truthy or falsy.
Since 3.55
- perform_test_for_libraries example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_libraries {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=libraries content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_libraries;
my
$perform_test_for_libraries
=
$test
->perform_test_for_libraries(
$data
,
);
# true
perform_test_for_license
perform_test_for_license(arrayref
$data
) (boolean)
The perform_data_for_license method performs an overridable test for the license
section and returns truthy or falsy.
Since 3.55
- perform_test_for_license example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_license {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=license content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_license;
my
$perform_test_for_license
=
$test
->perform_test_for_license(
$data
,
);
# true
perform_test_for_message
perform_test_for_message(arrayref
$data
) (boolean)
The perform_data_for_message method performs an overridable test for the message $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_message example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_message {
my
(
$self
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=message $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_message(
'accept'
);
my
$perform_test_for_message
=
$test
->perform_test_for_message(
'accept'
,
$data
,
);
# true
perform_test_for_metadata
perform_test_for_metadata(arrayref
$data
) (boolean)
The perform_data_for_metadata method performs an overridable test for the metadata $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_metadata example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_metadata {
my
(
$self
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=metadata $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_metadata(
'execute'
);
my
$perform_test_for_metadata
=
$test
->perform_test_for_metadata(
'execute'
,
$data
,
);
# true
perform_test_for_method
perform_test_for_method(arrayref
$data
) (boolean)
The perform_data_for_method method performs an overridable test for the method $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_method example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_method {
my
(
$self
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=method $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_method(
'execute'
);
my
$perform_test_for_method
=
$test
->perform_test_for_method(
'execute'
,
$data
,
);
# true
perform_test_for_name
perform_test_for_name(arrayref
$data
) (boolean)
The perform_data_for_name method performs an overridable test for the name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_name example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_name {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_name;
my
$perform_test_for_name
=
$test
->perform_test_for_name(
$data
,
);
# true
perform_test_for_operator
perform_test_for_operator(arrayref
$data
) (boolean)
The perform_data_for_operator method performs an overridable test for the operator $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_operator example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_operator {
my
(
$self
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=operator $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_operator(
'("")'
);
my
$perform_test_for_operator
=
$test
->perform_test_for_operator(
'("")'
,
$data
,
);
# true
perform_test_for_partials
perform_test_for_partials(arrayref
$data
) (boolean)
The perform_data_for_partials method performs an overridable test for the partials
section and returns truthy or falsy.
Since 3.55
- perform_test_for_partials example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_partials {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=partials content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_partials;
my
$perform_test_for_partials
=
$test
->perform_test_for_partials(
$data
,
);
# true
perform_test_for_project
perform_test_for_project(arrayref
$data
) (boolean)
The perform_data_for_project method performs an overridable test for the project
section and returns truthy or falsy.
Since 3.55
- perform_test_for_project example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_project {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=project content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_project;
my
$perform_test_for_project
=
$test
->perform_test_for_project(
$data
,
);
# true
perform_test_for_signature
perform_test_for_signature(arrayref
$data
) (boolean)
The perform_data_for_signature method performs an overridable test for the signature $name
section and returns truthy or falsy.
Since 3.55
- perform_test_for_signature example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_signature {
my
(
$self
,
$name
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=signature $name content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_signature(
'execute'
);
my
$perform_test_for_signature
=
$test
->perform_test_for_signature(
'execute'
,
$data
,
);
# true
perform_test_for_synopsis
perform_test_for_synopsis(arrayref
$data
) (boolean)
The perform_data_for_synopsis method performs an overridable test for the synopsis
section and returns truthy or falsy.
Since 3.55
- perform_test_for_synopsis example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_synopsis {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=synopsis content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_synopsis;
my
$perform_test_for_synopsis
=
$test
->perform_test_for_synopsis(
$data
,
);
# true
perform_test_for_tagline
perform_test_for_tagline(arrayref
$data
) (boolean)
The perform_data_for_tagline method performs an overridable test for the tagline
section and returns truthy or falsy.
Since 3.55
- perform_test_for_tagline example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_tagline {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=tagline content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_tagline;
my
$perform_test_for_tagline
=
$test
->perform_test_for_tagline(
$data
,
);
# true
perform_test_for_version
perform_test_for_version(arrayref
$data
) (boolean)
The perform_data_for_version method performs an overridable test for the version
section and returns truthy or falsy.
Since 3.55
- perform_test_for_version example 1
-
package
Example::Test;
base
'Venus::Test'
;
sub
perform_test_for_version {
my
(
$self
,
$data
) =
@_
;
my
$result
=
length
(
join
"\n"
, @{
$data
}) ? true : false;
$self
->pass(
$result
,
"=version content"
);
return
$result
;
}
package
main;
my
$test
= Example::Test->new(
't/path/pod/example'
);
my
$data
=
$test
->collect_data_for_version;
my
$perform_test_for_version
=
$test
->perform_test_for_version(
$data
,
);
# true
present
present(string
$name
, any
@args
) (string)
The present method dispatches to the present_data_for_${name}
method indictated by the first argument and returns the result. Returns an arrayref in scalar context, and a list in list context.
Since 3.55
- present example 1
-
# given: synopsis
package
main;
my
$present
=
$test
->present(
'name'
);
# =head1 NAME
#
# Venus::Test - Test Class
#
# =cut
present_data_for_abstract
present_data_for_abstract() (arrayref)
The present_data_for_abstract method builds a documentation block for the abstract
section and returns it as a string.
Since 3.55
- present_data_for_abstract example 1
-
# =abstract
#
# Example Test Documentation
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_abstract
=
$test
->present_data_for_abstract;
# =head1 ABSTRACT
#
# Example Test Documentation
#
# =cut
present_data_for_attribute
present_data_for_attribute(string
$name
) (arrayref)
The present_data_for_attribute method builds a documentation block for the attribute $name
section and returns it as a string.
Since 3.55
- present_data_for_attribute example 1
-
# =attribute name
#
# The name attribute is read-write, optional, and holds a string.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_attribute
=
$test
->present_data_for_attribute(
'name'
);
# =head2 name
#
# The name attribute is read-write, optional, and holds a string.
#
# =over 4
#
# =item name example 1
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =back
#
# =cut
present_data_for_authors
present_data_for_authors() (arrayref)
The present_data_for_authors method builds a documentation block for the authors
section and returns it as a string.
Since 3.55
-
# =authors
#
# Awncorp, C<awncorp@cpan.org>
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_authors
=
$test
->present_data_for_authors;
# =head1 AUTHORS
#
# Awncorp, C<awncorp@cpan.org>
#
# =cut
present_data_for_description
present_data_for_description() (arrayref)
The present_data_for_description method builds a documentation block for the description
section and returns it as a string.
Since 3.55
- present_data_for_description example 1
-
# =description
#
# This package provides an example class.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_description
=
$test
->present_data_for_description;
# =head1 DESCRIPTION
#
# This package provides an example class.
#
# =cut
present_data_for_encoding
present_data_for_encoding() (arrayref)
The present_data_for_encoding method builds a documentation block for the encoding
section and returns it as a string.
Since 3.55
- present_data_for_encoding example 1
-
# =encoding
#
# utf8
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_encoding
=
$test
->present_data_for_encoding;
# =encoding UTF8
#
# =cut
present_data_for_error
present_data_for_error(string
$name
) (arrayref)
The present_data_for_error method builds a documentation block for the error $name
section and returns it as a string.
Since 3.55
- present_data_for_error example 1
-
# =error error_on_unknown
#
# This package may raise an error_on_unknown error.
#
# =cut
#
# =example-1 error_on_unknown
#
# # given: synopsis
#
# my $error = $example->catch('error', {
# with => 'error_on_unknown',
# });
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_error
=
$test
->present_data_for_error(
'error_on_unknown'
);
# =over 4
#
# =item error: C<error_on_unknown>
#
# This package may raise an error_on_unknown error.
#
# B<example 1>
#
# # given: synopsis
#
# my $error = $example->catch('error', {
# with => 'error_on_unknown',
# });
#
# # "..."
#
# =back
present_data_for_example
present_data_for_example(number
$numberm
string
$name
) (arrayref)
The present_data_for_example method builds a documentation block for the example-$number $name
section and returns it as a string.
Since 3.55
- present_data_for_example example 1
-
# =attribute name
#
# The name attribute is read-write, optional, and holds a string.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_example
=
$test
->present_data_for_example(1,
'name'
);
# =over 4
#
# =item name example 1
#
# # given: synopsis
#
# my $name = $example->name;
#
# # "..."
#
# =back
present_data_for_feature
present_data_for_feature(string
$name
) (arrayref)
The present_data_for_feature method builds a documentation block for the feature $name
section and returns it as a string.
Since 3.55
- present_data_for_feature example 1
-
# =feature noop
#
# This package is no particularly useful features.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_feature
=
$test
->present_data_for_feature(
'noop'
);
# =over 4
#
# =item noop
#
# This package is no particularly useful features.
#
# =back
present_data_for_function
present_data_for_function(string
$name
) (arrayref)
The present_data_for_function method builds a documentation block for the function $name
section and returns it as a string.
Since 3.55
- present_data_for_function example 1
-
# =function eg
#
# The eg function returns a new instance of Example.
#
# =cut
#
# =example-1 name
#
# # given: synopsis
#
# my $example = eg();
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_function
=
$test
->present_data_for_function(
'eg'
);
# =head2 eg
#
# The eg function returns a new instance of Example.
#
# =cut
present_data_for_includes
present_data_for_includes() (arrayref)
The present_data_for_includes method builds a documentation block for the includes
section and returns it as a string.
Since 3.55
- present_data_for_includes example 1
-
# =includes
#
# function: eg
#
# method: prepare
# method: execute
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_includes
=
$test
->present_data_for_includes;
# undef
present_data_for_inherits
present_data_for_inherits() (arrayref)
The present_data_for_inherits method builds a documentation block for the inherits
section and returns it as a string.
Since 3.55
- present_data_for_inherits example 1
-
# =inherits
#
# Venus::Core::Class
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_inherits
=
$test
->present_data_for_inherits;
# =head1 INHERITS
#
# This package inherits behaviors from:
#
# L<Venus::Core::Class>
#
# =cut
present_data_for_integrates
present_data_for_integrates() (arrayref)
The present_data_for_integrates method builds a documentation block for the integrates
section and returns it as a string.
Since 3.55
- present_data_for_integrates example 1
-
# =integrates
#
# Venus::Role::Catchable
# Venus::Role::Throwable
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_integrates
=
$test
->present_data_for_integrates;
# =head1 INTEGRATES
#
# This package integrates behaviors from:
#
# L<Venus::Role::Catchable>
#
# L<Venus::Role::Throwable>
#
# =cut
present_data_for_layout
present_data_for_layout() (arrayref)
The present_data_for_layout method builds a documentation block for the layout
section and returns it as a string.
Since 3.55
- present_data_for_layout example 1
-
# =layout
#
# encoding
# name
# synopsis
# description
# attributes: attribute
# authors
# license
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_layout
=
$test
->present_data_for_layout;
# undef
present_data_for_libraries
present_data_for_libraries() (arrayref)
The present_data_for_libraries method builds a documentation block for the libraries
section and returns it as a string.
Since 3.55
- present_data_for_libraries example 1
-
# =libraries
#
# Venus::Check
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_libraries
=
$test
->present_data_for_libraries;
# =head1 LIBRARIES
#
# This package uses type constraints from:
#
# L<Venus::Check>
#
# =cut
present_data_for_license
present_data_for_license() (arrayref)
The present_data_for_license method builds a documentation block for the license
section and returns it as a string.
Since 3.55
- present_data_for_license example 1
-
# =license
#
# No license granted.
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_license
=
$test
->present_data_for_license;
# =head1 LICENSE
#
# No license granted.
#
# =cut
present_data_for_message
present_data_for_message(string
$name
) (arrayref)
The present_data_for_message method builds a documentation block for the message $name
section and returns it as a string.
Since 3.55
- present_data_for_message example 1
-
# =message accept
#
# The accept message represents acceptance.
#
# =cut
#
# =example-1 accept
#
# # given: synopsis
#
# my $accept = $example->accept;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_message
=
$test
->present_data_for_message(
'accept'
);
# =over 4
#
# =item accept
#
# The accept message represents acceptance.
#
# B<example 1>
#
# # given: synopsis
#
# my $accept = $example->accept;
#
# # "..."
#
# =back
present_data_for_metadata
present_data_for_metadata(string
$name
) (arrayref)
The present_data_for_metadata method builds a documentation block for the metadata $name
section and returns it as a string.
Since 3.55
- present_data_for_metadata example 1
-
# =method prepare
#
# The prepare method prepares for execution.
#
# =cut
#
# =metadata prepare
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 prepare
#
# # given: synopsis
#
# my $prepare = $example->prepare;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_metadata
=
$test
->present_data_for_metadata(
'prepare'
);
# undef
present_data_for_method
present_data_for_method(string
$name
) (arrayref)
The present_data_for_method method builds a documentation block for the method $name
section and returns it as a string.
Since 3.55
- present_data_for_method example 1
-
# =method execute
#
# The execute method executes the logic.
#
# =cut
#
# =metadata execute
#
# {since => 1.2.3}
#
# =cut
#
# =example-1 execute
#
# # given: synopsis
#
# my $execute = $example->execute;
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_method
=
$test
->present_data_for_method(
'execute'
);
# =head2 execute
#
# execute() (boolean)
#
# The execute method executes the logic.
#
# I<Since C<1.2.3>>
#
# =over 4
#
# =item execute example 1
#
# # given: synopsis
#
# my $execute = $example->execute;
#
# # "..."
#
# =back
#
# =cut
present_data_for_name
present_data_for_name() (arrayref)
The present_data_for_name method builds a documentation block for the name
section and returns it as a string.
Since 3.55
- present_data_for_name example 1
-
# =name
# Example
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_name
=
$test
->present_data_for_name;
# =head1 NAME
#
# Example - Example Class
#
# =cut
present_data_for_operator
present_data_for_operator(string
$name
) (arrayref)
The present_data_for_operator method builds a documentation block for the operator $name
section and returns it as a string.
Since 3.55
- present_data_for_operator example 1
-
# =operator ("")
#
# This package overloads the C<""> operator.
#
# =cut
#
# =example-1 ("")
#
# # given: synopsis
#
# my $string = "$example";
#
# # "..."
#
# =cut
package
main;
my
$test
= test
't/path/pod/example'
;
my
$present_data_for_operator
=
$test
->present_data_for_operator(
'("")'
);
# =over 4
#
# =item operation: C<("")>
#
# This package overloads the C<""> operator.
#
# B<example 1>
#
# # given: synopsis
#
# my $string = "$example";
#
# # "..."
#
# =back
render
render(string
$file
) (Venus::Path)
The render method reads the test specification and generates perlpod documentation and returns a Venus::Path object for the filename provided.
Since 3.55
- render example 1
-
# given: synopsis
package
main;
my
$path
=
$test
->render(
't/path/pod/test'
);
# bless(..., "Venus::Path")
same
same(any
$data1
, any
$data2
, string
$description
) (any)
The same method dispatches to the "is_deeply" in Test::More operation and returns the result.
Since 3.55
- same example 1
-
# given: synopsis
package
main;
my
$same
=
$test
->same({1..4}, {1..4},
'example-1 same passed'
);
# true
skip
skip(string
$description
, boolean | coderef
$value
) (any)
The skip method dispatches to the "skip" in Test::More operation with the plan_all
option and returns the result.
Since 3.55
FEATURES
This package provides the following features:
- spec
-
# [required]
=name
=abstract
=tagline
=synopsis
=description
# [optional]
=includes
=libraries
=inherits
=integrates
# [optional; repeatable]
=attribute
$name
=signature
$name
=example-
$number
$name
# [repeatable]
# [optional; repeatable]
=function
$name
=signature
$name
=example-
$number
$name
# [repeatable]
# [optional; repeatable]
=message
$name
=signature
$name
=example-
$number
$name
# [repeatable]
# [optional; repeatable]
=method
$name
=signature
$name
=example-
$number
$name
# [repeatable]
# [optional; repeatable]
=routine
$name
=signature
$name
=example-
$number
$name
# [repeatable]
# [optional; repeatable]
=feature
$name
=example
$name
# [optional; repeatable]
=error
$name
=example
$name
# [optional; repeatable]
=operator
$name
=example
$name
# [optional]
=partials
=authors
=license
=project
The specification is designed to accommodate typical package declarations. It is used by the parser to provide the content used in test automation and document generation. Note: When code blocks are evaluated, the "redefined" warnings are now automatically disabled.
- spec-abstract
-
=abstract
Example Test Documentation
=cut
$test
->
for
(
'abstract'
);
The
abstract
block should contain a subtitle describing the package. This is tested for existence.
- spec-attribute
-
=attribute name
The name attribute is read-write, optional, and holds a string.
=example-1 name
# given: synopsis
my $name = $example->name;
# "..."
=cut
$test
->
for
(
'attribute'
,
'name'
);
$test
->
for
(
'example'
, 1,
'name'
,
sub
{
my
(
$tryable
) =
@_
;
$tryable
->result;
});
Describing an attribute requires at least three blocks, i.e.
attribute $name
,signature $name
, andexample-$number $name
. Theattribute
block should contain a description of the attribute and its purpose. Thesignature
block should contain a routine signature in the form of$signature : $return_type
, where$signature
is a valid typed signature and$return_type
is any valid Venus::Check expression. Theexample-$number
block is a repeatable block, and at least one block must exist when documenting an attribute. Theexample-$number
block should contain valid Perl code and return a value. The block may contain a "magic" comment in the form ofgiven: synopsis
orgiven: example-$number $name
which if present will include the given code example(s) with the evaluation of the current block. Each attribute is tested and must be recognized to exist.
-
=authors
Awncorp, C<awncorp@cpan.org>
=cut
$test
->
for
(
'authors'
);
The
authors
block should contain text describing the authors of the package.
- spec-description
-
=description
This package provides an example class.
=cut
$test
->
for
(
'description'
);
The
description
block should contain a description of the package and it's behaviors.
- spec-encoding
-
=encoding
utf8
=cut
$test
->
for
(
'encoding'
);
The
encoding
block should contain the appropriate encoding.
- spec-error
-
=error error_on_unknown
This package may raise an error_on_unknown error.
=example-1 error_on_unknown
# given: synopsis
my $error = $example->error;
# "..."
=cut
$test
->
for
(
'error'
,
'error_on_unknown'
);
$test
->
for
(
'example'
, 1,
'error_on_unknown'
,
sub
{
my
(
$tryable
) =
@_
;
$tryable
->result;
});
The
error $name
block should contain a description of the error the package may raise, and can include anexample-$number $name
block to ensure the error is raised and caught.
- spec-example
-
=example-1 name
# given: synopsis
my $name = $example->name;
# "..."
=cut
$test
->
for
(
'example'
, 1,
'name'
,
sub
{
my
(
$tryable
) =
@_
;
$tryable
->result;
});
The
example-$number $name
block should contain valid Perl code and return a value. The block may contain a "magic" comment in the form ofgiven: synopsis
orgiven: example-$number $name
which if present will include the given code example(s) with the evaluation of the current block.
- spec-feature
-
=feature noop
This package is no particularly useful features.
=example-1 noop
# given: synopsis
my $feature = $example->feature;
# "..."
=cut
$test
->
for
(
'feature'
);
$test
->
for
(
'example'
, 1,
'noop'
,
sub
{
my
(
$tryable
) =
@_
;
$tryable
->result;
});
The
feature $name
block should contain a description of the feature(s) the package enables, and can include anexample-$number $name
block to ensure the feature described works as expected.
- spec-function
-
=function eg
The eg function returns a new instance of Example.
=example-1 eg
# given: synopsis
my $example = eg();
# "..."
=cut
$test
->
for
(
'function'
,
'eg'
);
$test
->
for
(
'example'
, 1,
'eg'
,
sub
{
my
(
$tryable
) =
@_
;
$tryable
->result;
});
Describing a function requires at least three blocks, i.e.
function $name
,signature $name
, andexample-$number $name
. Thefunction
block should contain a description of the function and its purpose. Thesignature
block should contain a routine signature in the form of$signature : $return_type
, where$signature
is a valid typed signature and$return_type
is any valid Venus::Check expression. Theexample-$number
block is a repeatable block, and at least one block must exist when documenting an attribute. Theexample-$number
block should contain valid Perl code and return a value. The block may contain a "magic" comment in the form ofgiven: synopsis
orgiven: example-$number $name
which if present will include the given code example(s) with the evaluation of the current block. Each attribute is tested and must be recognized to exist.
- spec-includes
-
=includes
function: eg
method: prepare
method: execute
=cut
$test
->
for
(
'includes'
);
The
includes
block should contain a list offunction
,method
, and/orroutine
names in the format of$type: $name
. Empty (or commented out) lines are ignored. Each function, method, and/or routine is tested to be documented properly, i.e. has the requisite counterparts (e.g. signature and at least one example block). Also, the package must recognize that each exists.
- spec-inherits
-
=inherits
Venus::Core::Class
=cut
$test
->
for
(
'inherits'
);
The
inherits
block should contain a list of parent packages. These packages are tested for loadability.
- spec-integrates
-
=integrates
Venus::Role::Catchable
Venus::Role::Throwable
=cut
$test
->
for
(
'integrates'
);
The
integrates
block should contain a list of packages that are involved in the behavior of the main package. These packages are not automatically tested.
- spec-layout
-
=layout
encoding
name
synopsis
description
attributes: attribute
authors
license
=cut
$test
->
for
(
'layout'
);
The
layout
block should contain a list blocks to render using "render", in the order they should be rendered.
- spec-libraries
-
=libraries
Venus::Check
=cut
$test
->
for
(
'libraries'
);
The
libraries
block should contain a list of packages, each describing how particular type names used within function and method signatures will be validated. These packages are tested for loadability.
- spec-license
-
=license
No license granted.
=cut
$test
->
for
(
'license'
);
The
license
block should contain a link and/or description of the license governing the package.
- spec-message
-
=message accept
The accept message represents acceptance.
=example-1 accept
# given: synopsis
my $accept = $example->accept;
# "..."
=cut
$test
->
for
(
'message'
,
'accept'
);
$test
->
for
(
'example'
, 1,
'accept'
,
sub
{
my
(
$tryable
) =
@_
;
$tryable
->result;
});
Describing a message requires at least three blocks, i.e.
message $name
,signature $name
, andexample-$number $name
. Themessage
block should contain a description of the message and its purpose. Thesignature
block should contain a routine signature in the form of$signature : $return_type
, where$signature
is a valid typed signature and$return_type
is any valid Venus::Check expression. Theexample-$number
block is a repeatable block, and at least one block must exist when documenting an attribute. Theexample-$number
block should contain valid Perl code and return a value. The block may contain a "magic" comment in the form ofgiven: synopsis
orgiven: example-$number $name
which if present will include the given code example(s) with the evaluation of the current block. Each attribute is tested and must be recognized to exist.
- spec-metadata
-
=metadata prepare
{since => "1.2.3"}
=cut
$test
->
for
(
'metadata'
,
'prepare'
);
The
metadata $name
block should contain a stringified hashref containing Perl data structures used in the rendering of the package's documentation.
- spec-method
-
=method prepare
The prepare method prepares for execution.
=example-1 prepare
# given: synopsis
my $prepare = $example->prepare;
# "..."
=cut
$test
->
for
(
'method'
,
'prepare'
);
$test
->
for
(
'example'
, 1,
'prepare'
,
sub
{
my
(
$tryable
) =
@_
;
$tryable
->result;
});
Describing a method requires at least three blocks, i.e.
method $name
,signature $name
, andexample-$number $name
. Themethod
block should contain a description of the method and its purpose. Thesignature
block should contain a routine signature in the form of$signature : $return_type
, where$signature
is a valid typed signature and$return_type
is any valid Venus::Check expression. Theexample-$number
block is a repeatable block, and at least one block must exist when documenting an attribute. Theexample-$number
block should contain valid Perl code and return a value. The block may contain a "magic" comment in the form ofgiven: synopsis
orgiven: example-$number $name
which if present will include the given code example(s) with the evaluation of the current block. Each attribute is tested and must be recognized to exist.
- spec-name
-
=name
Example
=cut
$test
->
for
(
'name'
);
The
name
block should contain the package name. This is tested for loadability.
- spec-operator
-
=operator ("")
This package overloads the C<""> operator.
=example-1 ("")
# given: synopsis
my $string = "$example";
# "..."
=cut
$test
->
for
(
'operator'
,
'("")'
);
$test
->
for
(
'example'
, 1,
'("")'
,
sub
{
my
(
$tryable
) =
@_
;
$tryable
->result;
});
The
operator $name
block should contain a description of the overloaded operation the package performs, and can include anexample-$number $name
block to ensure the operation is functioning properly.
- spec-partials
-
=partials
t/path/to/other.t: present: authors
t/path/to/other.t: present: license
=cut
$test
->
for
(
'partials'
);
The
partials
block should contain references to other marked-up test files in the form of$file: $method: $section
, which will call the$method
on a Venus::Test instance for the$file
and include the results in-place as part of the rendering of the current file.
- spec-signature
-
=signature prepare
prepare() (boolean)
=cut
$test
->
for
(
'signature'
,
'prepare'
);
The
signature $name
block should contain a routine signature in the form of$signature : $return_type
, where$signature
is a valid typed signature and$return_type
is any valid Venus::Check expression.
- spec-synopsis
-
=synopsis
use Example;
my $example = Example->new;
# bless(..., "Example")
=cut
$test
->
for
(
'synopsis'
,
sub
{
my
(
$tryable
) =
@_
;
$tryable
->result;
});
The
synopsis
block should contain the normative usage of the package. This is tested for existence. This block should be written in a way that allows it to be evaled successfully and should return a value.
- spec-tagline
-
=tagline
Example Class
=cut
$test
->
for
(
'tagline'
);
The
tagline
block should contain a 2-5 word description of the package, which will be prepended to the name as a full description of the package.
- spec-version
-
=version
1.2.3
=cut
$test
->
for
(
'version'
);
The
version
block should contain a valid version number for the package.
- test-for
-
# ...
$test
->
for
(
'name'
);
This framework provides a set of automated subtests based on the package specification, but not everything can be automated so it also provides you with powerful hooks into the framework for manual testing.
# ...
$test
->
for
(
'synopsis'
,
sub
{
my
(
$tryable
) =
@_
;
my
$result
=
$tryable
->result;
# must return truthy to continue
$result
;
});
The code examples documented can be automatically evaluated (evaled) and returned using a callback you provide for further testing. Because the code examples are returned as Venus::Try objects this makes capturing and testing exceptions simple, for example:
# ...
$test
->
for
(
'synopsis'
,
sub
{
my
(
$tryable
) =
@_
;
# catch exception thrown by the synopsis
$tryable
->
catch
(
'Path::Find::Error'
,
sub
{
return
$_
[0];
});
# test the exception
my
$result
=
$tryable
->result;
ok
$result
->isa(
'Path::Find::Error'
),
'exception caught'
;
# must return truthy to continue
$result
;
});
Additionally, another manual testing hook (with some automation) is the
example
method. This hook evaluates (evals) a given example and returns the result as a Venus::Try object. The first argument is the example ID (or number), for example:# ...
$test
->
for
(
'example'
, 1,
'children'
,
sub
{
my
(
$tryable
) =
@_
;
my
$result
=
$tryable
->result;
# must return truthy to continue
$result
;
});
Finally, the lesser-used but useful manual testing hook is the
feature
method. This hook evaluates (evals) a documented feature and returns the result as a Venus::Try object, for example:# ...
$test
->
for
(
'feature'
,
'export-path-make'
,
sub
{
my
(
$tryable
) =
@_
;
ok
my
$result
=
$tryable
->result,
'result ok'
;
# must return truthy to continue
$result
;
});
The test automation and documentation generation enabled through this framework makes it easy to maintain source/test/documentation parity. This also increases reusability and reduces the need for complicated state and test setup.
ERRORS
This package may raise the following errors:
- error:
error_on_abstract
-
This package may raise an error_on_abstract exception.
example 1
# given: synopsis;
my
$input
= {
throw
=>
'error_on_abstract'
,
};
my
$error
=
$test
->
catch
(
'error'
,
$input
);
# my $name = $error->name;
# "on_abstract"
# my $message = $error->render;
# "Test file \"t/Venus_Test.t\" missing abstract section"
# my $file = $error->stash('file');
# "t/Venus_Test.t"
- error:
error_on_description
-
This package may raise an error_on_description exception.
example 1
# given: synopsis;
my
$input
= {
throw
=>
'error_on_description'
,
};
my
$error
=
$test
->
catch
(
'error'
,
$input
);
# my $name = $error->name;
# "on_description"
# my $message = $error->render;
# "Test file \"t/Venus_Test.t\" missing description section"
# my $file = $error->stash('file');
# "t/Venus_Test.t"
- error:
error_on_name
-
This package may raise an error_on_name exception.
example 1
# given: synopsis;
my
$input
= {
throw
=>
'error_on_name'
,
};
my
$error
=
$test
->
catch
(
'error'
,
$input
);
# my $name = $error->name;
# "on_name"
# my $message = $error->render;
# "Test file \"t/Venus_Test.t\" missing name section"
# my $file = $error->stash('file');
# "t/Venus_Test.t"
- error:
error_on_synopsis
-
This package may raise an error_on_synopsis exception.
example 1
# given: synopsis;
my
$input
= {
throw
=>
'error_on_synopsis'
,
};
my
$error
=
$test
->
catch
(
'error'
,
$input
);
# my $name = $error->name;
# "on_synopsis"
# my $message = $error->render;
# "Test file \"t/Venus_Test.t\" missing synopsis section"
# my $file = $error->stash('file');
# "t/Venus_Test.t"
- error:
error_on_tagline
-
This package may raise an error_on_tagline exception.
example 1
# given: synopsis;
my
$input
= {
throw
=>
'error_on_tagline'
,
};
my
$error
=
$test
->
catch
(
'error'
,
$input
);
# my $name = $error->name;
# "on_tagline"
# my $message = $error->render;
# "Test file \"t/Venus_Test.t\" missing tagline section"
# my $file = $error->stash('file');
# "t/Venus_Test.t"
AUTHORS
Awncorp, awncorp@cpan.org
LICENSE
Copyright (C) 2022, Awncorp, awncorp@cpan.org
.
This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.