Skip to content

Commit

Permalink
Merge pull request #2219 from MitrahSoft/fileSeek()
Browse files Browse the repository at this point in the history
Added a testcase for fileSeek() function
  • Loading branch information
zspitzer authored Sep 8, 2023
2 parents a43d881 + ecaaeef commit d85fb27
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 d85fb27

Please sign in to comment.