Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stevedonovan/Penlight.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpusztai <rpusztai@g3630-ubuntu.gentex.com>2010-04-07 19:41:48 +0400
committerrpusztai <rpusztai@g3630-ubuntu.gentex.com>2010-04-07 19:41:48 +0400
commit8bb790ef186b6c6b5bfd59bc16de63a05e7712c6 (patch)
tree535aed1b119df88c2b4716bbbdf3f3a937cd6cc4 /tests/test-dir.lua
parent3fa1c3a880ce400d2887037dabde979bc38729b2 (diff)
Fixed #47624 - pl.dir.MoveFile is broken on windows with alien.
Added test for move file. Updated docs.
Diffstat (limited to 'tests/test-dir.lua')
-rwxr-xr-x[-rw-r--r--]tests/test-dir.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test-dir.lua b/tests/test-dir.lua
index b975f0b..ed60cd1 100644..100755
--- a/tests/test-dir.lua
+++ b/tests/test-dir.lua
@@ -1,6 +1,8 @@
-- This test file expects to be ran from 'run.lua' in the root Penlight directory.
local dir = require( "pl.dir" )
+local file = require( "pl.file" )
+local path = require( "pl.path" )
local asserteq = require( "pl.test" ).asserteq
local pretty = require( "pl.pretty" )
@@ -10,3 +12,24 @@ local files = dir.getallfiles( "docs/", "*.txt" )
asserteq( files, expected )
+-- Test move files -----------------------------------------
+--
+-- Create a dummy file
+local fileName = "poot.txt"
+file.write( fileName, string.rep( "poot ", 1000 ) )
+
+local newFileName = "move_test.txt"
+local err, msg = dir.movefile( fileName, newFileName )
+
+-- Make sure the move is successful
+asserteq( err, true )
+
+-- Check to make sure the original file is gone
+asserteq( path.exists( fileName ), false )
+
+-- Check to make sure the new file is there
+asserteq( path.exists( newFileName ), true )
+
+-- Clean up
+file.delete( newFileName )
+