16 lines
841 B
Text
16 lines
841 B
Text
|
Test::Deep gives you very flexible ways to check that the result
|
||
|
you got is the result you were expecting. At its simplest it compares
|
||
|
two structures by going through each level, ensuring that the values
|
||
|
match, that arrays and hashes have the same elements and that
|
||
|
references are blessed into the correct class. It also handles
|
||
|
circular data structures without getting caught in an infinite
|
||
|
loop.
|
||
|
|
||
|
Where it becomes more interesting is in allowing you to do something
|
||
|
besides simple exact comparisons. With strings, the = operator
|
||
|
checks that 2 strings are exactly equal but sometimes that's not
|
||
|
what you want. When you don't know exactly what the string should
|
||
|
be but you do know some things about how it should look, = is no
|
||
|
good and you must use pattern matching instead. Test::Deep provides
|
||
|
pattern matching for complex data structures.
|