-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathFrmFilesTests.sb
More file actions
45 lines (38 loc) · 1.11 KB
/
FrmFilesTests.sb
File metadata and controls
45 lines (38 loc) · 1.11 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
' ------------------------------------------------
Function Test_AppendContents()
filePath = File.GetTemporaryFilePath()
File.AppendContents(filePath, "Test 1")
File.AppendContents(filePath, "Test 2")
Return UnitTest.AssertEqual(
File.ReadContents(filePath),
"Test 1Test 2",
"File.AppendContents"
)
EndFunction
' ------------------------------------------------
Function Test_AppendLines()
filePath = File.GetTemporaryFilePath()
File.AppendLines(filePath, "Test 1")
File.AppendLines(filePath, {"Test 2", "Test 3"})
Return UnitTest.AssertEqual(
File.ReadContents(filePath),
"Test 1" & Text.NewLine &
"Test 2" & Text.NewLine &
"Test 3" & Text.NewLine,
"File.AppendLines"
)
EndFunction
' ------------------------------------------------
Function Test_WriteAndReadArray()
a = {1, 2, 3, 4}
path = File.GetTemporaryFilePath()
If File.WriteArray(path, a) Then
Return UnitTest.AssertEqual(
File.ReadArray(path),
{1, 2, 3, 4},
"File.Write/ReadArray"
)
Else
Return File.LastError
EndIf
EndFunction