Skip to content

Commit

Permalink
LDEV-389 improve testcase, enable passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Sep 29, 2023
1 parent e54d767 commit 2e507bd
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 58 deletions.
61 changes: 61 additions & 0 deletions test/tickets/LDEV0389.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
component extends="org.lucee.cfml.test.LuceeTestCase" {
function beforeAll(){
variables.tempDir = getTempDirectory() & createUUID();
if ( !DirectoryExists( tempDir ) ){
DirectoryCreate( tempDir );
}

variables.testFile = '#tempDir##server.separator.file#ldev0389.txt';
if ( !FileExists( variables.testFile ) ){
FileWrite( variables.testFile, "hello world");
}
}

function afterAll(){
if ( FileExists( variables.testFile ) ){
FileDelete( variables.testFile );
}
if ( !DirectoryExists( tempDir ) ){
DirectoryDelete( tempDir );
}
}

function run( testResults , testBox ) {
describe( "Test suite for LDEV-389", function() {
it("Checking directoryList, callback function with no arguments", function( currentSpec ) {
try {
result = directoryList( variables.tempDir, true, "array", function(){
return true;
});
} catch ( any e ){
result[1] = e.stacktrace;
}
expect( result[ 1 ] ).toBe( variables.testFile );
});

it("Checking directoryList, callback function with single argument", function( currentSpec ) {
try {
result = directoryList( variables.tempDir, true, "array", function(a){
return true;
});
} catch ( any e ){
result[1] = e.stacktrace;
}
expect( result[ 1 ] ).toBe( variables.testFile );
});

// this isn't supported, throws UDF filter has too many arguments [2], should have at maximum 1 argument
it("Checking directoryList, callback function with two arguments", skip=true, function( currentSpec ) {
try {
result = directoryList( variables.tempDir, true, "array", function( a, b ){
return true;
});
} catch ( any e ){
result[1] = e.stacktrace;
}
expect( result[ 1 ] ).toBe( variables.testFile );
});
});
}

}
58 changes: 0 additions & 58 deletions test/tickets/_LDEV0389.cfc

This file was deleted.

0 comments on commit 2e507bd

Please sign in to comment.