Skip to content

Commit

Permalink
Unit test to test rename on directories
Browse files Browse the repository at this point in the history
Added a unit test to ensure mv/rename also works on directories in
addition to files.

Ref JuliaLang#4157
  • Loading branch information
lifeissweetgood committed Nov 6, 2013
1 parent 38a33ed commit b90d142
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ mv(file, newfile)
@test isfile(newfile) == true
file = newfile

# Test renaming directories
a_tmpdir = mktempdir()
b_tmpdir = joinpath(dir, "b_tmpdir")

# grab a_tmpdir's file info before renaming
a_stat = stat(a_tmpdir)

# rename, then make sure b_tmpdir does exist and a_tmpdir doesn't
mv(a_tmpdir, b_tmpdir)
@test isdir(b_tmpdir) == true
@test isdir(a_tmpdir) == false

# get b_tmpdir's file info and compare with a_tmpdir
b_stat = stat(b_tmpdir)
@test Base.samefile(a_stat, b_stat) == true

rmdir(b_tmpdir)

#######################################################################
# This section tests file watchers. #
#######################################################################
Expand Down

0 comments on commit b90d142

Please sign in to comment.