<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<!--
This file was generated by Devel::Cover Version 1.18
Devel::Cover is copyright 2001-2012, Paul Johnson (paul@pjcj.net)
Devel::Cover is free. It is licensed under the same terms as Perl itself.
The latest version of Devel::Cover should be available from my homepage:
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta http-equiv="Content-Language" content="en-us"></meta>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<title>File Coverage: blib/lib/Test/Mocha/CalledOk.pm</title>
</head>
<body>
<h1>File Coverage</h1>
<table>
<tr><td class="h" align="right">File:</td><td align="left">blib/lib/Test/Mocha/CalledOk.pm</td></tr>
<tr><td class="h" align="right">Coverage:</td><td align="left" class="c3">100.0%</td></tr>
</table>
<div><br/></div>
<table>
<tr><th>line</th><th>stmt</th><th>bran</th><th>cond</th><th>sub</th><th>pod</th><th>time</th><th>code</th></tr>
<tr><td class="h">1</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">package Test::Mocha::CalledOk;</td></tr>
<tr><td class="h">2</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"># ABSTRACT: Abstract base class for verifying method calls</td></tr>
<tr><td class="h">3</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"># Abstract class methods required of sub-classes: 'is' and 'stringify'</td></tr>
<tr><td class="h">4</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">$Test::Mocha::CalledOk::VERSION = '0.61';</td></tr>
<tr><td class="h">5</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-CalledOk-pm--subroutine.html#L5">12</a></div></td><td></td><td><div>4080</div><div>9</div><div>229</div></td><td class="s">use strict;</td></tr>
<tr><td class="h">6</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-CalledOk-pm--subroutine.html#L6">12</a></div></td><td></td><td><div>21</div><div>8</div><div>149</div></td><td class="s">use warnings;</td></tr>
<tr><td class="h">7</td><td colspan="7"></td></tr><tr><td class="h">8</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-CalledOk-pm--subroutine.html#L8">12</a></div></td><td></td><td><div>24</div><div>11</div><div>1607</div></td><td class="s">use Test::Builder;</td></tr>
<tr><td class="h">9</td><td colspan="7"></td></tr><tr><td class="h">10</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">my $TB = Test::Builder->new;</td></tr>
<tr><td class="h">11</td><td colspan="7"></td></tr><tr><td class="h">12</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub test {</td></tr>
<tr><td class="h">13</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> # uncoverable pod</td></tr>
<tr><td class="h">14</td><td><div class="c3">90</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-CalledOk-pm--subroutine.html#L14">90</a></div></td><td><div class="c3">0</div></td><td><div>64</div></td><td class="s"> my ( $class, $method_call, $exp, $test_name ) = @_;</td></tr>
<tr><td class="h">15</td><td colspan="7"></td></tr><tr><td class="h">16</td><td><div class="c3">90</div></td><td></td><td></td><td></td><td></td><td><div>105</div></td><td class="s"> my $calls = $method_call->invocant->__calls;</td></tr>
<tr><td class="h">17</td><td><div class="c3">90</div><div class="c3">371</div><div class="c3">90</div></td><td></td><td></td><td></td><td></td><td><div>65</div><div>7079</div><div>69</div></td><td class="s"> my $got = grep { $method_call->__satisfied_by($_) } @{$calls};</td></tr>
<tr><td class="h">18</td><td><div class="c3">90</div></td><td></td><td></td><td></td><td></td><td><div>938</div></td><td class="s"> my $test_ok = $class->is( $got, $exp );</td></tr>
<tr><td class="h">19</td><td colspan="7"></td></tr><tr><td class="h">20</td><td><div class="c3">90</div></td><td></td><td></td><td></td><td></td><td><div>117</div></td><td class="s"> my $exp_times = $class->stringify($exp);</td></tr>
<tr><td class="h">21</td><td><div class="c3">90</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-CalledOk-pm--branch.html#L21">100</a></div></td><td></td><td></td><td></td><td><div>140</div></td><td class="s"> $test_name = "$method_call was called $exp_times" if !defined $test_name;</td></tr>
<tr><td class="h">22</td><td colspan="7"></td></tr><tr><td class="h">23</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> # Test failure report should not trace back to Mocha modules</td></tr>
<tr><td class="h">24</td><td><div class="c3">90</div></td><td></td><td></td><td></td><td></td><td><div>79</div></td><td class="s"> local $Test::Builder::Level = $Test::Builder::Level + 1;</td></tr>
<tr><td class="h">25</td><td><div class="c3">90</div></td><td></td><td></td><td></td><td></td><td><div>112</div></td><td class="s"> $TB->ok( $test_ok, $test_name );</td></tr>
<tr><td class="h">26</td><td colspan="7"></td></tr><tr><td class="h">27</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> # output diagnostics to aid with debugging</td></tr>
<tr><td class="h">28</td><td><div class="c3">90</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-CalledOk-pm--branch.html#L28">100</a></div></td><td><div class="c3"><a href="blib-lib-Test-Mocha-CalledOk-pm--condition.html#L28">100</a></div></td><td></td><td></td><td><div>11786</div></td><td class="s"> unless ( $test_ok || $TB->in_todo ) {</td></tr>
<tr><td class="h">29</td><td><div class="c3">8</div></td><td></td><td></td><td></td><td></td><td><div>114</div></td><td class="s"> my $call_history;</td></tr>
<tr><td class="h">30</td><td><div class="c3">8</div><div class="c3">8</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-CalledOk-pm--branch.html#L30">100</a></div></td><td></td><td></td><td></td><td><div>7</div><div>9</div></td><td class="s"> if ( @{$calls} ) {</td></tr>
<tr><td class="h">31</td><td><div class="c3">7</div><div class="c3">7</div></td><td></td><td></td><td></td><td></td><td><div>5</div><div>17</div></td><td class="s"> $call_history .= "\n " . $_->stringify_long foreach @{$calls};</td></tr>
<tr><td class="h">32</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">33</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> else {</td></tr>
<tr><td class="h">34</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>1</div></td><td class="s"> $call_history = "\n (No methods were called)";</td></tr>
<tr><td class="h">35</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">36</td><td colspan="7"></td></tr><tr><td class="h">37</td><td><div class="c3">8</div></td><td></td><td></td><td></td><td></td><td><div>18</div></td><td class="s"> $TB->diag(<<"END");</td></tr>
<tr><td class="h">38</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">Error: unexpected number of calls to '$method_call'</td></tr>
<tr><td class="h">39</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> got: $got time(s)</td></tr>
<tr><td class="h">40</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> expected: $exp_times</td></tr>
<tr><td class="h">41</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">Complete method call history (most recent call last):$call_history</td></tr>
<tr><td class="h">42</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">END</td></tr>
<tr><td class="h">43</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">44</td><td><div class="c3">90</div></td><td></td><td></td><td></td><td></td><td><div>494</div></td><td class="s"> return;</td></tr>
<tr><td class="h">45</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">46</td><td colspan="7"></td></tr><tr><td class="h">47</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">1;</td></tr>
</table>
</body>
</html>