Branch Coverage

blib/lib/File/System/Test.pm
Criterion Covered Total %
branch 96 182 52.7


line true false branch
31 0 18665 if (not $true) { }
123 0 6 unless _check(defined $obj, $name, 'root object does not exist')
126 0 6 unless _check($obj->path eq $root->path, $name, "root object path [$obj] does not match ->root path [$root]")
129 0 6 unless _check($obj->path eq '/', $name, "root object path is [$obj] instead of the desired [/]")
132 0 6 unless _check($obj->path eq "$obj", $name, "root object stringify was [$obj] instead of [", $obj->path, ']')
135 0 6 unless _check($obj->basename eq '/', $name, 'root object basename was [', $obj->basename, '] instead of [/]')
138 0 6 unless _check($obj->dirname eq '/', $name, 'root object dirname was [', $obj->dirname, '] instead of [/]')
141 0 6 unless _check($obj->is_root, $name, "root object [$obj] is not reporting is_root")
144 0 6 unless _check($obj->path eq $parent->path, $name, "root object path is [$obj] but parent is [$parent]")
147 0 6 unless _check(grep(/^basename$/, $obj->properties), $name, "root object [$obj] properties missing basename")
150 0 6 unless _check(grep(/^dirname$/, $obj->properties), $name, "root object [$obj] properties missing dirname")
153 0 6 unless _check(grep(/^path$/, $obj->properties), $name, "root object [$obj] properties missing path")
156 0 6 unless _check($obj->is_container, $name, "root object [$obj] is not a container")
159 0 24 unless _check($obj->exists($path), $name, "root [$obj] cannot access file path [$path]")
162 0 24 unless _check($obj->path eq $lookup->path, $name, "root object path [$obj] does not match ->lookup($path) path [$lookup]")
215 0 676 unless _check(defined $obj, 'object does not exist')
217 0 676 unless _check($obj->path eq "$obj", $name, "object stringify was [$obj] instead of [", $obj->path, ']')
221 0 676 unless _check($obj->path eq $lookup->path, $name, "object lookup($obj) results in [$lookup] instead of expected [$obj]")
224 0 676 unless _check($obj->basename eq $obj->basename_of_path($obj->path), $name, "object [$obj] basename was [", $obj->basename, '] instead of [', $obj->basename_of_path($obj->path), ']')
228 0 676 unless _check($obj->dirname eq $obj->dirname_of_path($obj->path), $name, "object [$obj] dirname was [", $obj->dirname, '] instead of [', $obj->dirname_of_path($obj->path), ']')
232 0 676 unless _check(!$obj->is_root, $name, "object [$obj] is incorrectly reporting is_root")
235 0 676 unless _check($obj->dirname eq $parent->path, $name, "object [$obj] dirname is [", $obj->dirname, "] but parent path is [$parent]")
238 0 676 unless _check(grep(/^basename$/, $obj->properties), $name, "object [$obj] properties missing basename")
241 0 676 unless _check(grep(/^dirname$/, $obj->properties), $name, "object [$obj] properties missing dirname")
244 0 676 unless _check(grep(/^path$/, $obj->properties), $name, "object [$obj] properties missing path")
296 0 114 unless _check($obj->is_container, $name, "is_container [$obj] does not return true")
298 0 114 unless _check($obj->can('has_children'), $name, "container [$obj] does not have a 'has_children' method.")
301 0 114 unless _check($obj->can('children_paths'), $name, "container [$obj] does not have a 'children_paths' method.")
304 0 114 unless _check($obj->can('children'), $name, "container [$obj] does not have a 'children' method.")
307 0 114 unless _check($obj->can('child'), $name, "container [$obj] does not have a 'child' method.")
313 0 114 unless _check(grep(/^\.$/, @children_paths), $name, "container [$obj] does not contain a '.' child.")
316 0 114 unless _check(grep(/^\.\.$/, @children_paths), $name, "container [$obj] does not contain a '..' child.")
319 84 30 if ($obj->has_children) { }
320 0 84 unless _check(grep((!/^\.\.?$/), @children_paths), $name, "container [$obj] says it has children but children_paths returns none")
323 0 84 unless _check(scalar @children > 0, $name, "container [$obj] says it has children but children returns none")
333 0 281 unless _check($lookup_path eq $child_path, $name, "container [$obj] doesn't find the same object via child() [$child_path] as it does for lookup() [$lookup_path] of $path")
337 0 30 unless _check(!grep((!/^\.\.?$/), @children_paths), $name, 'container says it has no children but children_paths returns some')
340 0 30 unless _check(scalar @children == 0, $name, 'container says it has no children but children returns some')
365 0 224 unless _check($obj->has_content, $name, "has_content [$obj] does not return true")
412 0 224 unless _check($obj->is_readable, $name, "is_readable [$obj] returns false")
414 0 224 unless _check($obj->is_writable, $name, "is_writable [$obj] returns false")
417 0 224 unless _check(defined $fh, $name, "open('w') [$obj] returns undef")
428 0 1120 unless _check(print($fh $line), $name, "print [$obj] failed on file handle")
431 0 224 unless _check(close $fh, $name, "[$obj] failed to close file handle")
434 0 224 unless _check($content eq join('', @expected), $name, "[$obj] content read from file '${content}' doesn't match expected")
439 0 1120 unless _check($content[$n] eq $expected[$n], $name, "[$obj] content read from line $n of file, '$content[$n]', doesn't match expected")
443 224 0 if ($obj->is_appendable)
445 0 224 unless _check(defined $fh, $name, "open('a') [$obj] returns undef")
447 0 224 unless _check(print($fh "quux\n"), $name, "print [$obj] failed on appendable file handle")
449 0 224 unless _check(close $fh, $name, "[$obj] failed to close appendable file handle")
453 0 224 unless _check($content eq join('', @expected), $name, "[$obj] content read from appended file '${content}' doesn't match expected")
457 224 0 if ($obj->is_seekable)
459 0 224 unless _check(defined $fh, $name, "open('w') [$obj] returns undef")
461 0 224 unless _check(seek($fh, 16, 0), $name, "seek [$obj] returned a failure")
463 0 224 unless _check(print($fh "huh\n"), $name, "print [$obj] failed on seeked file handle")
465 0 224 unless _check(close $fh, $name, "[$obj] failed to close seeked file handle")
469 0 224 unless _check($content eq join('', @expected), $name, "[$obj] content read from seeked file '${content}' doesn't match expected")
498 0 31 unless _check($obj->rename('renamed_container')->path eq $renamed_path, $name, "renamed container path is '${obj}' rather than '${renamed_path}'")
502 0 38 unless _check(!$path->exists, $name, "renamed container '${obj}' failed to rename child from '${path}'")
507 0 38 unless _check($obj->exists($path), $name, "renamed container '${obj}' failed to rename child to '${path}'")
511 0 31 unless _check($obj->rename($basename)->path eq $path, $name, "originally renamed container path is '${obj}' rather than '${path}'")
515 0 38 unless _check($path->exists, $name, "originally renamed container '${obj}' failed to rename child to '${path}'")
520 0 38 unless _check(!$obj->exists($path), $name, "originally renamed container '${obj}' failed to rename child from '${path}'")
531 0 31 unless _check($obj->move($dest, 'force')->path eq $new_path, $name, "moved container path is '${obj}' rather than '${new_path}'")
535 0 38 unless _check(!$obj->exists($path), $name, "moved container '${obj}' failed to move child from '${path}'")
540 0 38 unless _check($obj->exists($path), $name, "moved container '${obj}' failed to move child to '${path}'")
544 0 31 unless _check($obj->move($parent, 'force')->path eq $path, $name, "originally moved container path is '${obj}' rather than '${path}'")
548 0 38 unless _check($path->exists, $name, "originally moved container '${obj}' failed to move child to '${path}'")
553 0 38 unless _check(!$obj->exists($path), $name, "originally moved container '${obj}' failed to move child from '${path}'")
559 0 31 unless _check($copy->path eq $new_path, $name, "copied container path is '${obj}' rather than '${new_path}'")
563 0 38 unless _check($obj->exists($path), $name, "original container '${obj}' lost child from '${path}' after copy")
568 0 38 unless _check($obj->exists($path), $name, "copied container '${copy}' failed to copy child to '${path}'")
574 0 31 unless _check(!$copy->is_valid, $name, "removed container '${copy}' is still valid")
578 0 38 unless _check($path->exists, $name, "pre-copy container '${obj}' lost child to '${path}' when copy container '${copy}' was removed")
583 0 38 unless _check(!$obj->exists($path), $name, "removed container '${copy}' failed to remove child from '${path}'")
606 0 217 unless _check($obj->rename('renamed_content')->path eq $renamed_path, $name, "renamed content path is '${obj}' rather than '${renamed_path}'")
609 0 217 unless _check($obj->rename($basename)->path eq $path, $name, "originally renamed content path is '${obj}' rather than '${path}'")
616 0 217 unless _check($obj->move($dest)->path eq $new_path, $name, "moved content path is '${obj}' rather than '${new_path}'")
619 0 217 unless _check($obj->move($parent)->path eq $path, $name, "originally moved content path is '${obj}' rather than '${path}'")
624 0 217 unless _check($copy->path eq $new_path, $name, "copied content path is '${obj}' rather than '${new_path}'")
629 0 217 unless _check(!$copy->is_valid, $name, "removed content '${copy}' is still valid")
651 436 814 if not $_[0]->path =~ m[/\.[^/]+$] and $_[0]->parent eq $obj
654 436 814 if $_[0]->parent eq $obj and not $_[0]->path =~ m[/\.[^/]+$]
657 728 522 if $_[0]->parent eq $obj
659 170 116 if $_[0]->path =~ m[^$obj/?[^/]+/] and not $_[0]->path =~ m[^$obj/?[^/]+/[^/]+/] and not $_[0]->path =~ m[/\.[^/]+$]
679 0 512 unless _check(@glob eq @find, $name, "in '${obj}' for '$$test[0]', glob returned [ $glob_err ] but find returned [ $find_err ]")
681 0 512 unless _check(@glob eq @root_glob, $name, "in '${obj}' for '$$test[0]', obj glob returned [ $glob_err ] but root glob returned [ $root_glob_err ]")
683 0 512 unless _check(@find eq @root_find, $name, "in '${obj}' for '$$test[0]', obj find returned [ $find_err ] but root find returned [ $root_find_err ]")
686 0 466 unless _check($glob[$i] eq $find[$i], $name, "in '${obj}' element $i of glob was '$glob[$i]', but element $i of find was '$find[$i]'")
688 0 466 unless _check($glob[$i] eq $root_glob[$i], $name, "in '${obj}' element $i of obj glob was '$glob[$i]', but element $i of root glob was '$root_glob[$i]'")
690 0 466 unless _check($find[$i] eq $root_find[$i], $name, "in '${obj}' element $i of obj find was '$find[$i]', but element $i of root find was '$root_find[$i]'")