MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001258XdebugUsage problems (Wrong Results)public2016-01-20 18:332016-02-23 20:25
Reporterasgrim 
Assigned Toderick 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSUbuntuOS Version15.04
Product Version2.4.0rc3 
Target VersionFixed in Version2.4.0 
Summary0001258: Coverage does not cover `case` statements
DescriptionI have a switch statement that is fully tested, and all execution paths do not appear to be covered when viewed with PHP_CodeCoverage.

I queried on IRC, and a very kind and helpful Mr Rethans said "I probably don't overload the opcode - please submit a bug", so here it is!

I'm happy to try and create a proper reproducible test case if the provided code sample is not sufficient.
Steps To Reproduceprivate function compileBinaryOp(Node\BinaryOp\AbstractBinaryOp $node, InputData $inputData)
{
    $left = $this->compileNode($node->getLeft(), $inputData);
    $right = $this->compileNode($node->getRight(), $inputData);

    switch (get_class($node)) {
        case Node\BinaryOp\Equals::class:
            return $left == $right;
        case Node\BinaryOp\NotEquals::class:
            return $left != $right;
        case Node\BinaryOp\BooleanAnd::class:
            return $left && $right;
        case Node\BinaryOp\BooleanOr::class:
            return $left || $right;
        case Node\BinaryOp\GreaterThan::class:
            return $left > $right;
        case Node\BinaryOp\GreaterThanOrEqual::class:
            return $left >= $right;
        case Node\BinaryOp\LessThan::class:
            return $left < $right;
        case Node\BinaryOp\LessThanOrEqual::class:
            return $left <= $right;
        case Node\BinaryOp\In::class:
            return in_array($left, $right);
        case Node\BinaryOp\NotIn::class:
            return !in_array($left, $right);
        default:
            throw UnknownNodeType::fromNode($node);
    }
}
TagsNo tags attached.
Operating SystemUbuntu 15.04
PHP Version7.0.0-7.0.4
Attached Filespng file icon coverage.png [^] (138,193 bytes) 2016-01-20 18:33

- Relationships

-  Notes
(0003495)
robob4him (reporter)
2016-02-15 22:34

Confirmed for 2.4.0rc4
(0003515)
derick (administrator)
2016-02-23 20:25

Fixed for 2.4.0. Thanks for the report, and the PR with the test case!

- Issue History
Date Modified Username Field Change
2016-01-20 18:33 asgrim New Issue
2016-01-20 18:33 asgrim File Added: coverage.png
2016-02-15 22:34 robob4him Note Added: 0003495
2016-02-23 20:25 derick Note Added: 0003515
2016-02-23 20:25 derick Status new => closed
2016-02-23 20:25 derick Assigned To => derick
2016-02-23 20:25 derick Resolution open => fixed
2016-02-23 20:25 derick Fixed in Version => 2.4.0
2016-07-31 13:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 13:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker