-
-
Notifications
You must be signed in to change notification settings - Fork 185
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 #2279 from MitrahSoft/LDEV-4736
Added a testcase to the directoryEvery() function for LDEV-4736
- Loading branch information
Showing
2 changed files
with
46 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,40 @@ | ||
component extends = "org.lucee.cfml.test.LuceeTestCase" labels="directoryEvery"{ | ||
|
||
function beforeAll() { | ||
variables.name = ListFirst(ListLast(getCurrentTemplatePath(), "\/"), "."); | ||
variables.parent = getDirectoryFromPath(getCurrentTemplatePath()) & name & Server.separator.file & "parent"; | ||
variables.SEP = Server.separator.file; | ||
variables.path = parent&createUUID(); | ||
variables.path2 = path&"#SEP#a"; | ||
|
||
directoryCreate(path2); | ||
cffile (action="write" addnewline="yes" file="#path##SEP#b.txt" output="aaa" fixnewline="no"); | ||
cffile (action="write" addnewline="yes" file="#path2##SEP#c.txt" output="aaa" fixnewline="no"); | ||
} | ||
|
||
function run( testresults , testbox ) { | ||
describe( "Testcase for DirectoryEvery() function", function() { | ||
it( title = "Checking DirectoryEvery() with recurse=false", body = function ( currentSpec ) { | ||
savecontent variable="result" { | ||
DirectoryEvery( path, new LDEV4736.LDEV_4736(), false); | ||
}; | ||
expect(result).toInclude("b.txt"); | ||
expect(result).toInclude("a"); | ||
}); | ||
|
||
it( title = "Checking DirectoryEvery() with recurse=true", body = function ( currentSpec ) { | ||
savecontent variable="result" { | ||
DirectoryEvery( path, new LDEV4736.LDEV_4736(), true); | ||
}; | ||
expect(result).toInclude("a"); | ||
expect(result).toInclude("b.txt"); | ||
expect(result).toInclude("c.txt"); | ||
}); | ||
}); | ||
} | ||
|
||
function afterAll(){ | ||
if(directoryExists(parent)) directorydelete(parent, true); | ||
directoryDelete(path, true); | ||
} | ||
} |
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,6 @@ | ||
component { | ||
function invoke( path ) { | ||
writeoutput( path ); | ||
return true; | ||
} | ||
} |