Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a Testcase in DirectoryList() function for LDEV-4747 #2270

Merged
merged 2 commits into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions test/tickets/LDEV4747.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
component extends="org.lucee.cfml.test.LuceeTestCase" skip=true {

function beforeAll() {
variables.uri = createURI("LDEV4747");
if ( !directoryExists( uri ) ) {
directoryCreate( uri );
}
}

function run( testResults, testBox ) {
describe( title = "Testcase for LDEV-4747", body = function() {
it(title = "Testcase for DirectoryList() function", body = function( currentSpec ) {
fileWrite(uri&"/00001_RenameTbl_G4Agent.sql", "");
fileWrite(uri&"/00002_CreateTbl_G4AgentSite.sql", "");
fileWrite(uri&"/00002a_AddData_G4AgentSite.sql", "");
buildFiles = DirectoryList(path=uri, recurse=false, listInfo=false, type="file", sort='name asc',
filter=function(thefile) {
return Left(GetFileFromPath(thefile), 1) neq 'z';
}
);
expect(buildfiles[1]).toInclude("00001_RenameTbl_G4Agent.sql")
expect(buildfiles[2]).toInclude("00002_CreateTbl_G4AgentSite.sql")
expect(buildfiles[3]).toInclude("00002a_AddData_G4AgentSite.sql")
});
});
}
private string function createURI(string calledName){
var baseURI = "/test/#listLast(getDirectoryFromPath(getCurrentTemplatePath()),"\/")#/";
return baseURI & "" & calledName;
}

function afterAll() {
if ( directoryExists(uri) ) {
directoryDelete( uri, true );
}
}
}
Loading