SVN-Class

 view release on metacpan or  search on metacpan

t/01-svn.t  view on Meta::CPAN

        if ( -d $repos && -s "$repos/format" ) {
            skip "repos setup already complete", 5;
        }

        ok( $repos->mkpath(1), "repos path made" );
        ok( $work->mkpath(1),  "work path made" );
        ok( run( command => "svnadmin create $repos" ),
            "repos $repos created" );

        # create a project in repos and check it out in $work
        ok( run( command => "svn mkdir file://$repos/test -m init" ),
            "test project created in repos" );

        ok( run( command => "svn co file://$repos/test $work" ),
            "test checked out" );

    }

    # set up is done. now let's test our SYNOPSIS.

    #  SVN::Class::File
    ok( my $file = svn_file( $work, 'test1' ), "new svn_file" );    # 1

    #$file->_debug_stdin_fh;
    #$file->_debug_stdout_fh;

    $file->debug(1) if $debug;
    ok( my $fh = $file->open('>>'), "filehandle created" );
    ok( print( {$fh} "hello world\n" ), "hello world" );
    ok( $fh->close,                        "filehandle closed" );
    ok( $file->add,                        "$file scheduled for commit" );
    ok( $file->modified,                   "$file status == modified" );   # 6
    ok( $file->commit('the file changed'), "$file committed" );
    diag( "error: " . $file->errstr . " : $!" ) if $file->error_code;
    ok( my $log = $file->log, "$file has a log" );
    is( $file->outstr, join( "\n", @$log, "" ), "outstr" );

    # SVN::Class::Dir
    ok( my $dir = svn_dir( $work, 'testdir' ), "new svn_dir" );
    $dir->debug(1) if $debug;
    ok( -d $dir ? 1 : $dir->mkpath, "$dir mkpath" );    # 11
    ok( $dir->add, "$dir scheduled for commit" );
    is( $dir->status, 'A', "dir status is schedule for Add" );

    #diag( join( "", `ls -l $work` ) );
    ok( $dir->commit('new dir'), "$dir committed" );
    diag( "error: " . $dir->errstr . " : $!" ) if $dir->error_code;
    is( $dir->status, 0, "dir status is 0 since it has not changed" );

    # SVN::Class::Info
    ok( my $info = $dir->info, "get info" );            # 16
    is( $info->path, $dir, "working path" );

    # SVN::Class::Repos
    #diag(dump $info);
    #diag($info->url);
    #diag(dump $info->url);
    is( $info->url, $info->url->info->url, "recursive URL" );
    ok( my $repos = SVN::Class::Repos->new( 'file://' . $repos ),
        "new repos object" );
    my $thisuser = getpwuid($<);
    is( $repos->info->author, $thisuser,
        "$thisuser was last author to commit to $repos" );    # 20

}    # end global SKIP



( run in 0.981 second using v1.01-cache-2.11-cpan-d7f47b0818f )