Test::Symlink - Test::Builder based test for symlink correctness
use Test::Symlink tests => 3; symlink_ok('foo', 'bar', 'foo links to bar'); symlink_ok('foo' => 'bar', 'Use fat comma for visual clarity'); # The test name is optional symlink_ok('foo' => 'bar') # ok 3 - Symlink: foo -> bar
Test::Symlink automatically exports
symlink_ok() for testing the correctness of symlinks. Test::Symlink uses Test::Builder, so plays nicely with Test::Simple, Test::More, and other Test::Builder based modules.
Verifies that $src exists, and is a symlink to $dst.
Does not verify that $dst exists, as this is legal, and there is at least one valid usage of this that I'm aware of (/etc/malloc.conf on FreeBSD). If you want to ensure that the destination exists then write this as two tests. For example:
ok(-e $dst, "$dst exists"); symlink_ok($src, $dst, " ... and $src links to it");
The test name (
$test_name) is optional. If it is omitted then a test name of the form "Symlink: $src -> $dst" is used.
Perl's fat comma operator can be usefully used as an visual aid.
The test will be skipped on systems that do not support symlinks. However, the arguments to symlink_ok() will still be checked to ensure that they are defined and non-empty.
Nik Clayton, <nik@FreeBSD.org>
Please report any bugs or feature requests to
email@example.com, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Symlink. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
Copyright (c) 2003 Nik Clayton All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.