~ubuntu-branches/ubuntu/saucy/padre/saucy-proposed

« back to all changes in this revision

Viewing changes to t/92-padre-file.t

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont, gregor herrmann, Dominique Dumont
  • Date: 2012-01-04 12:04:20 UTC
  • mfrom: (1.3.3)
  • Revision ID: package-import@ubuntu.com-20120104120420-i5oybqwf91m1d3il
Tags: 0.92.ds1-1
[ gregor herrmann ]
* Remove debian/source/local-options; abort-on-upstream-changes
  and unapply-patches are default in dpkg-source since 1.16.1.
* Swap order of alternative (build) dependencies after the perl
  5.14 transition.

[ Dominique Dumont ]
* Imported Upstream version 0.92.ds1
* removed fix-spelling patch (applied upstream)
* lintian-override: use wildcard to avoid listing a gazillion files
* updated size of some 'not-real-man-page' entries
* rules: remove dekstop cruft (replaced by a file provided in debian
  directory)
* control: removed Breaks statement. Add /me to uploaders. Updated
  dependencies
* rules: make sure that non-DFSG file (i.e. the cute butterfly, sigh)
  is not distributed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
use strict;
4
 
use warnings;
5
 
use Test::More tests => 26;
6
 
 
7
 
use Padre::File;
8
 
 
9
 
my $file = Padre::File->new();
10
 
ok( !defined($file), 'No filename' );
11
 
 
12
 
# Padre::File::Local
13
 
 
14
 
our $testfile = 't/files/padre-file-test';
15
 
 
16
 
ok( open( my $fh, '>', $testfile ), 'Local: Create test file' );
17
 
print $fh "foo";
18
 
close $fh;
19
 
is( -s $testfile, 3, 'Local: Check test file size' );
20
 
 
21
 
$file = Padre::File->new($testfile);
22
 
ok( defined($file), 'Local: Create Padre::File object' );
23
 
 
24
 
is( -s $testfile, 3, 'Local: Check test file size again' );
25
 
ok( ref($file) eq 'Padre::File::Local', 'Local: Check module' );
26
 
ok( $file->{protocol} eq 'local', 'Local: Check protocol' );
27
 
my @Stat1 = stat($testfile);
28
 
my @Stat2 = $file->stat;
29
 
for ( 0 .. $#Stat1 ) {
30
 
        ok( $Stat1[$_] eq $Stat2[$_], 'Local: Check stat value ' . $_ );
31
 
}
32
 
ok( $file->can_run, 'Local: Can run' );
33
 
 
34
 
# Check the most interesting functions only:
35
 
ok( $file->exists, 'Local: file exists' );
36
 
is( $file->size,     $Stat1[7],         'Local: file size' );
37
 
is( $file->mtime,    $Stat1[9],         'Local: file size' );
38
 
is( $file->basename, 'padre-file-test', 'Local: basename' );
39
 
 
40
 
# Allow both results (for windows):
41
 
like( $file->dirname, qr/(^|[\/\\])t[\/\\]files/, 'Local: dirname' );
42
 
 
43
 
undef $file;
44
 
 
45
 
END {
46
 
        unlink $testfile;
47
 
}