-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathfilename.jl
35 lines (28 loc) · 890 Bytes
/
filename.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import Mads
import Test
using Printf
workdir = "filename_testing"
@Mads.stderrcapture function jpath(file::AbstractString)
joinpath(workdir, file)
end
curdir = pwd()
Mads.madsdir()
cd(curdir)
Mads.rmdir(workdir)
Mads.mkdir(workdir)
touch(jpath("a-v01.mads"))
touch(jpath("a-v02.mads"))
touch(jpath("a-v03.mads"))
@Test.testset "Filename" begin
# Verify that getnextmadsfilename returns the most recently modified file
@Test.test Mads.getnextmadsfilename(jpath("a-v01.mads")) == jpath("a-v03.mads")
sleep(1)
touch(jpath("a-v02.mads"))
@Test.test Mads.getnextmadsfilename(jpath("a-v01.mads")) == jpath("a-v02.mads")
# Verify that Mads parses filename prefixes and extensions
touch(jpath("test.file.name.txt"))
@Test.test Mads.getrootname(jpath("test.file.name.txt")) == jpath("test")
@Test.test Mads.getextension(jpath("a-v01.mads")) == "mads"
end
Mads.rmdir(workdir)
:passed