-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2270 from MitrahSoft/LDEV-4747
Added a Testcase in DirectoryList() function for LDEV-4747
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | ||
} | ||
} | ||
} |