Skip to content

Commit

Permalink
LDEV-5034 test case forFileSetAccessMode
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jul 20, 2024
1 parent 7eb3d22 commit 5f8d402
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions test/functions/FileSetAccessMode.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
component extends="org.lucee.cfml.test.LuceeTestCase" {

function run( testResults, testBox ){
describe( "fileSetAccessMode", function(){

it( title="test access modes", skip=isNotUnix(), body=function(){

var dir = getTempDirectory() & "fileSetAccessMode/";
if ( !directoryExists( dir ) ){
directoryCreate( dir );
};

var tests = [];

arrayAppend( tests, _dir( dir, "755", "755" ) );
arrayAppend( tests, _dir( dir, "644", "644" ) );

arrayAppend( tests, _file( dir, "755/644.txt", "644" ) );
arrayAppend( tests, _file( dir, "755/743.txt", "743" ) );
arrayAppend( tests, _file( dir, "755/043.txt", "043" ) );

arrayAppend( tests, _file( dir, "644/400.txt", "400" ) );

var files = directoryList( dir, true, "query");
var st = QueryToStruct( files, "name" );

loop array=tests index="local.test"{
systemOutput( test, true );
}

loop array=st index="local.item"{
systemOutput( item, true );
}

});

} );
}

private function _dir(parent, name, mode){
var dir = directoryCreate( name & mode );
fileSetAccessMode( dir, mode );
return {
name: dir,
mode: mode,
type: "dir"
};
}

private function _file(parent, name, mode){
var file = fileWrite( parent & name, "" );
fileSetAccessMode( file, mode );
return {
name: file,
mode: mode,
type: "file"
};
}

private function isNotUnix(){
return (server.os.name != "windows");
}

}

0 comments on commit 5f8d402

Please sign in to comment.