-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilesystemTest.bb
More file actions
77 lines (68 loc) · 2.57 KB
/
Copy pathFilesystemTest.bb
File metadata and controls
77 lines (68 loc) · 2.57 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Strict
EnableGC
Global currentDir$ = CurrentDir$()
Function DeleteTestDirAndFiles()
DeleteFile(currentDir$ + "testfile.txt")
DeleteFile(currentDir$ + "testfile2.txt")
DeleteFile(currentDir$ + "testdir/subfile.txt")
DeleteFile(currentDir$ + "testdir2/subfile2.txt")
DeleteFile(currentDir$ + "testdir/subdir/subfile.txt")
DeleteFile(currentDir$ + "testdir2/subdir/subfile.txt")
DeleteDir(currentDir$ + "testdir/subdir")
DeleteDir(currentDir$ + "testdir2/subdir")
DeleteDir(currentDir$ + "testdir")
DeleteDir(currentDir$ + "testdir2")
End Function
Test testCreateDir()
CreateDir(currentDir$ + "testdir")
Assert(FileType(currentDir$ + "testdir") = 2)
DeleteTestDirAndFiles()
End Test
Test testCreateFile()
local file.BBStream = WriteFile(currentDir$ + "testfile.txt")
CloseFile(file)
Assert(FileType(currentDir$ + "testfile.txt") = 1)
DeleteTestDirAndFiles()
End Test
Test testCopyDir()
CreateDir(currentDir$ + "testdir")
CopyDir(currentDir$ + "testdir", currentDir$ + "testdir2")
Assert(FileType(currentDir$ + "testdir2") = 2)
DeleteTestDirAndFiles()
End Test
Test testCopyFile()
local file.BBStream = WriteFile(currentDir$ + "testfile.txt")
CloseFile(file)
CopyFile(currentDir$ + "testfile.txt", currentDir$ + "testfile2.txt")
Assert(FileType(currentDir$ + "testfile2.txt") = 1)
DeleteTestDirAndFiles()
End Test
Test testCopySubDir()
CreateDir(currentDir$ + "testdir")
CreateDir(currentDir$ + "testdir2")
CreateDir(currentDir$ + "testdir/subdir")
CreateDir(currentDir$ + "testdir2/subdir")
CopyDir(currentDir$ + "testdir", currentDir$ + "testdir2")
Assert(FileType(currentDir$ + "testdir2/subdir") = 2)
DeleteTestDirAndFiles()
End Test
Test testCopySubFile()
CreateDir(currentDir$ + "testdir")
CreateDir(currentDir$ + "testdir2")
local file.BBStream = WriteFile(currentDir$ + "testdir/subfile.txt")
CloseFile(file)
CopyFile(currentDir$ + "testdir/subfile.txt", currentDir$ + "testdir2/subfile2.txt")
Assert(FileType(currentDir$ + "testdir2/subfile2.txt") = 1)
DeleteTestDirAndFiles()
End Test
Test testCopySubDirWithFile()
CreateDir(currentDir$ + "testdir")
CreateDir(currentDir$ + "testdir2")
CreateDir(currentDir$ + "testdir/subdir")
CreateDir(currentDir$ + "testdir2/subdir")
local file.BBStream = WriteFile(currentDir$ + "testdir/subdir/subfile.txt")
CloseFile(file)
CopyDir(currentDir$ + "testdir", currentDir$ + "testdir2")
Assert(FileType(currentDir$ + "testdir2/subdir/subfile.txt") = 1)
DeleteTestDirAndFiles()
End Test