use strict;
use warnings FATAL => 'all';

use File::Temp qw(tempfile);

use APR::Finfo ();
use APR::Pool ();
use APR::Const -compile => qw(FINFO_NORM);

my($fh, $file) = tempfile(DIR => '.', UNLINK => 1);
close $fh;
print "Testing $file\n";
my @stats = stat($file);
print @stats ? "stat() ran OK\n" : "stat() failed: $!\n";
eval {
  my $finfo = APR::Finfo::stat($file, APR::Const::FINFO_NORM, APR::Pool->new());
  print "apr_stat() ran OK\n";
  1;
} or print "apr_stat() failed: $@\n";
unlink $file;

$file = 'test.txt';
open $fh, '>', $file;
close $fh;
print "Testing $file\n";
@stats = stat($file);
print @stats ? "stat() ran OK\n" : "stat() failed: $!\n";
eval {
  my $finfo = APR::Finfo::stat($file, APR::Const::FINFO_NORM, APR::Pool->new());
  print "apr_stat() ran OK\n";
  1;
} or print "apr_stat() failed: $@\n";
unlink $file;

$file = 'C:\\test.txt';
print "Testing $file\n";
@stats = stat($file);
print @stats ? "stat() ran OK\n" : "stat() failed: $!\n";
eval {
  my $finfo = APR::Finfo::stat($file, APR::Const::FINFO_NORM, APR::Pool->new());
  print "apr_stat() ran OK\n";
  1;
} or print "apr_stat() failed: $@\n";
