GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEST::STREAM::DELTA (3)

.ds Aq ’

NAME

Test::Stream::Delta - Representation of differences between nested data structures.

CONTENTS

DEPRECATED

<B>This distribution is deprecatedB> in favor of Test2, Test2::Suite, and Test2::Workflow.

See Test::Stream::Manual::ToTest2 for a conversion guide.

DESCRIPTION

This is used by Test::Stream::Compare. When data structures are compared a delta will be returned. Deltas are a tree datastructure that represent all the differences between 2 other data structures.

METHODS

    CLASS METHODS

$class->add_column($NAME => sub { ... })
$class->add_column($NAME, %PARAMS) This can be used to add columns to the table that it produced when a comparison fails. The first argument should always be the column name, which must be unique.

The first form simply takes a coderef that produces the value that should be displayed in the column for any given delta. The arguments passed into the sub are the delta, and the row id.



    Test::Stream::Delta->add_column(
        Foo => sub {
            my ($delta, $id) = @_;
            return $delta->... ? foo : bar
        },
    );



The second form allows you some extra options. The value key is required, and must be a coderef. All other keys are optional.



    Test::Stream::Delta->add_column(
        Foo,    # column name
        value => sub { ... },    # how to get the cell value
        alias       => FOO,    # Display name (used in table header)
        no_collapse => $bool,    # Show column even if it has no values?
    );



$bool = $class->remove_column($NAME) This will remove the specified column. This will return true if the column existed and was removed. This will return false if the column did not exist. No exceptions are thrown, if a missing column is a problem then you need to check the return yourself.

    ATTRIBUTES

$bool = $delta->verified
$delta->set_verified($bool) This will be true if the delta itself matched, if the delta matched then the problem is in the deltas children, not the delta itself.
$aref = $delta->id
$delta->set_id([$type, $name]) Id for the delta, this is used to produce the path into the data structure. An example is [HASH => foo] which means the delta is in the path ...->{foo}. Valid types are HASH, ARRAY, SCALAR, META, and METHOD.
$val = $delta->got
$delta->set_got($val) Deltas are produced by comparing a received data structure ’got’ against a check data structure ’check’. The ’got’ attribute contains the value that was received for comparison.
$check = $delta->chk
$check = $delta->check
$delta->set_chk($check)
$delta->set_check($check) Deltas are produced by comparing a received data structure ’got’ against a check data structure ’check’. The ’check’ attribute contains the value that was expected in the comparison.

check and chk are aliases for the same attribute.

$aref = $delta->children
$delta->set_children([$delta1, $delta2, ...]) A Delta may have child deltas, if it does then this is an arrayref with those children.
$dne = $delta->dne
$delta->set_dne($dne) Sometimes a comparison results in one side or the other not existing at all, in which case this is set to the name of the attribute that does not exist. This can be set to ’got’ or ’check’.
$e = $delta->exception
$delta->set_exception($e) This will be set to the exception in cases where the comparison failed due to an exception being thrown.

    OTHER

$string = $delta->render_got Renders the string that should be used in a table to represent the received value in a comparison.
$string = $delta->render_check Renders the string that should be used in a table to represent the expected value in a comparison.
$bool = $delta->should_show This will return true if the delta should be shown in the table. This is normally true for any unverified delta. This will also be true for deltas that contain extra useful debug information.
$aref = $delta->filter_visible This will produce an arrayref of [ $path => $delta ] for all deltas that should be displayed in the table.
$aref = $delta->table_header This returns an array ref of the headers for the table.
$string = $delta->table_op This returns the operator that should be shown in the table.
$string = $delta->table_check_lines This returns the defined lines (extra debug info) that should be displayed.
$string = $delta->table_got_lines This returns the generated lines (extra debug info) that should be displayed.
$aref = $delta->table_rows This returns an arrayref of table rows, each row is itself an arrayref.
@table_lines = $delta->table Returns all the lines of the table that should be displayed.

SOURCE

The source code repository for Test::Stream can be found at http://github.com/Test-More/Test-Stream/.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright 2015 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEST::STREAM::DELTA (3) 2016-02-05

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.