Skip to content

Commit

Permalink
Added a testcase for FileSeek.cfc() function
Browse files Browse the repository at this point in the history
  • Loading branch information
cfmitrah committed Aug 29, 2023
1 parent d321163 commit ecaaeef
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/functions/FileSeek.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
component extends="org.lucee.cfml.test.LuceeTestCase" {

function run( testResults , testBox ) {
describe( title = "Testcase for fileSeek() function", body = function() {
it( title = "checking fileSeek() function", body = function( currentSpec ) {
var file = getTempFile( getTempDirectory(), "fileSeek", "txt" );
fileWrite( file, "123" );
var file = fileOpen( file=file, mode="write", seekable=true );

fileSeek( file, 3 );
fileWrite( file, 45 );
expect( fileRead( file ) ).toBe( "12345" );

fileSeek( file, 2 );
fileWrite( file, 45 );
expect( fileRead( file ) ).toBe( "12455" );

fileclose( file );
if( fileExists( file ) ) fileDelete( file );
});
});
}
}

0 comments on commit ecaaeef

Please sign in to comment.