1use 5.008001; 2use strict; 3use warnings; 4use Test::More 0.96; 5use File::Temp (); 6 7use lib 't/lib'; 8use TestUtils qw/exception/; 9 10use Path::Tiny; 11 12my $tempdir = File::Temp->newdir; 13 14my $path = path($tempdir)->child("foo"); 15 16ok( !-e $path, "target directory not created yet" ); 17ok( $path->mkpath, "mkpath on directory returned true" ); 18ok( -d $path, "target directory created" ); 19 20if ( $^O ne 'MSWin32' ) { 21 my $path2 = path($tempdir)->child("bar"); 22 ok( !-e $path2, "target directory not created yet" ); 23 ok( $path2->mkpath( { mode => 0700 } ), "mkpath on directory with mode" ); 24 if ( $^O ne 'msys' ) { 25 is( $path2->stat->mode & 0777, 0700, "correct mode" ); 26 } 27 ok( -d $path2, "target directory created" ); 28} 29 30done_testing; 31# 32# This file is part of Path-Tiny 33# 34# This software is Copyright (c) 2014 by David Golden. 35# 36# This is free software, licensed under: 37# 38# The Apache License, Version 2.0, January 2004 39# 40