Test-Virtual-Filesystem

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

       CPANTesters: http://www.nntp.perl.org/group/perl.cpan.testers/2007/11/msg784219.html

0.04 :
     - Released: 2007 Nov 18
     - Summary: Renamed test_* methods from v0.03; Subclassing; Bug fixes

     - Incompatibility: Renamed 'test_*' methods to 'enable_test_*'

     - Fix: Add List::MoreUtils to Build.PL/Makefile.PL
       Credit: cpan-tester David Cantrell
     - Fix: Turn off symlink and chown for Win32; better support for OS non-features
       Credit: cpan-tester stro@cpan.org, MSWin32 (for symlink part)
     - Fix: Enable subclassing (via a hack/workaround for Test::Class 0.24 -- see rt.cpan.org 30836)

     - Internals: Moved self-test tests into subclasses in t/*.t

     - TODO: Remove above workaround if RT 30836 is resolved

     - Press: http://use.perl.org/~ChrisDolan/journal/34920

0.03 :

README  view on Meta::CPAN


SYNOPSIS
        use Test::Virtual::Filesystem;
        Test::Virtual::Filesystem->new({mountdir => '/path/to/test'})->runtests;

    or with more customization:

        use Test::Virtual::Filesystem;
        my $test = Test::Virtual::Filesystem->new({mountdir => '/path/to/test', compatible => '0.03'});
        $test->enable_test_xattr(1);
        $test->enable_test_chown(1);
        $test->enable_test_atime(1);
        $test->runtests;

    See the file t/filesys.t in this distribution or the file t/fusepdf.t in
    the Fuse::PDF distribution for thorough examples.

    WARNING: all of the files in the `mountdir' will be deleted in the
    `teardown' method so BE CAREFUL that you specify the right folder!

LICENSE

README  view on Meta::CPAN

        seek/rewinddir, tell/telldir
        read, sysread, syswrite
        overwrite (with open '+<')
        deep directories
        very full directories
        large files
        filenames with spaces
        non-ASCII filenames (maybe constructor should specify the encoding?)
        permissions
        special file types (fifos, sockets, character and block devices, etc)
        chown
        binmode, non-binmode
        eof
        fileno
        statfs (AKA `df` or `mount`)
        rename corner cases:
         * dest inside src
         * src or dest leaf is '.' or '..'
         * src or dest is FS root
         * dest leaf is symlink
        threading and re-entrancy

README  view on Meta::CPAN

        example MSWin32 and cygwin) as determined by
        `$Config::Config{d_symlink}'.

    $self->enable_test_hardlink()
        AKA the `link()' function. Default true. If set false, this also
        sets `nlink' false.

    $self->enable_test_nlink()
        Count hard links. Default true.

    $self->enable_test_chown()
        Default false.

TEST CASES
    setup()
        Runs before every test to prepare a directory for testing.

    teardown()
        Runs after every test to clean up the test directory so the next
        test will have a clean workspace.

README  view on Meta::CPAN

        Test as little as possible in each method. Let authors know what's
        failed by the pattern of failing tests. This also helps avoid
        needing to edit the tests later.

    Avoid editing methods
        Don't break published CPAN code. If you want to test something new,
        write a new method.

    Try to use a few different filesystem functions as practical in one
    method
        For example, if you're testing `chmod', don't `mkdir' or `chown'
        unless you're writing a `chmod_mkdir_chown' test.

    Minimize test infrastructure
        Use method attributes and Test::Class features to keep the test
        methods really simple.

SEE ALSO
    Test::Class

    Fuse::PDF

lib/Test/Virtual/Filesystem.pm  view on Meta::CPAN

         ctime => 1,
      },
      permissions => 0,
      special => {
         fifo => 0,
      },
      symlink => 1,
      hardlink => {
         nlink => 1,
      },
      chown => 0,
);

# if true, the feature is disabled no matter what.  For example, most versions
# of Windows at this writing do not support symlinks at all, regardless of
# whether your virtual filesystem supports them
Readonly::Hash my %feature_disabled => (
   $Config{d_symlink} ? () : (symlink => 1),
   $Config{d_chown} ? () : (chown => 1),
   eval {require File::ExtAttr; 1;} ? () : (xattr => 1),
);

=pod

=for stopwords TODO CPAN MSWin32

=head1 NAME

Test::Virtual::Filesystem - Validate a filesystem

lib/Test/Virtual/Filesystem.pm  view on Meta::CPAN

=head1 SYNOPSIS

    use Test::Virtual::Filesystem;
    Test::Virtual::Filesystem->new({mountdir => '/path/to/test'})->runtests;

or with more customization:

    use Test::Virtual::Filesystem;
    my $test = Test::Virtual::Filesystem->new({mountdir => '/path/to/test', compatible => '0.03'});
    $test->enable_test_xattr(1);
    $test->enable_test_chown(1);
    $test->enable_test_atime(1);
    $test->runtests;

See the file F<t/filesys.t> in this distribution or the file F<t/fusepdf.t> in
the L<Fuse::PDF> distribution for thorough examples.

WARNING: all of the files in the C<mountdir> will be deleted in the C<teardown>
method so BE CAREFUL that you specify the right folder!

=head1 LICENSE

lib/Test/Virtual/Filesystem.pm  view on Meta::CPAN

    seek/rewinddir, tell/telldir
    read, sysread, syswrite
    overwrite (with open '+<')
    deep directories
    very full directories
    large files
    filenames with spaces
    non-ASCII filenames (maybe constructor should specify the encoding?)
    permissions
    special file types (fifos, sockets, character and block devices, etc)
    chown
    binmode, non-binmode
    eof
    fileno
    statfs (AKA `df` or `mount`)
    rename corner cases:
     * dest inside src
     * src or dest leaf is '.' or '..'
     * src or dest is FS root
     * dest leaf is symlink
    threading and re-entrancy

lib/Test/Virtual/Filesystem.pm  view on Meta::CPAN

MSWin32 and cygwin) as determined by C<$Config::Config{d_symlink}>.

=item $self->enable_test_hardlink()

AKA the C<link()> function.  Default true.  If set false, this also sets C<nlink> false.

=item $self->enable_test_nlink()

Count hard links.  Default true.

=item $self->enable_test_chown()

Default false.

=back

=head1 TEST CASES

=over

=cut

lib/Test/Virtual/Filesystem.pm  view on Meta::CPAN


Test as little as possible in each method.  Let authors know what's failed by
the pattern of failing tests.  This also helps avoid needing to edit the tests later.

=item Avoid editing methods

Don't break published CPAN code.  If you want to test something new, write a new method.

=item Try to use a few different filesystem functions as practical in one method

For example, if you're testing C<chmod>, don't C<mkdir> or C<chown> unless
you're writing a C<chmod_mkdir_chown> test.

=item Minimize test infrastructure

Use method attributes and Test::Class features to keep the test methods really
simple.

=back

=head1 SEE ALSO



( run in 1.240 second using v1.01-cache-2.11-cpan-5511b514fd6 )