From ecaaeef2d173b5c1009b9708c321fee8c2d49ba7 Mon Sep 17 00:00:00 2001 From: CF Mitrah Date: Tue, 29 Aug 2023 20:09:31 +0530 Subject: [PATCH] Added a testcase for FileSeek.cfc() function --- test/functions/FileSeek.cfc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/functions/FileSeek.cfc diff --git a/test/functions/FileSeek.cfc b/test/functions/FileSeek.cfc new file mode 100644 index 0000000000..79a1b72ffe --- /dev/null +++ b/test/functions/FileSeek.cfc @@ -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 ); + }); + }); + } +} \ No newline at end of file