1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-09-20 04:24:48 +00:00
QB64-PE/tests/compile_tests/qb64pe/file.bas
Roland Heyder 8ea4302239 Some file related refactoring
- using the new _READFILE$ and _WRITEFILE commands where applicable
- moved error handler changes inside CopyFile&() so we don't need to remember to do this before calling the function
  - fixed file tests complaining about missing error handlers
2024-07-15 13:00:47 +02:00

54 lines
1 KiB
QBasic

DEFLNG A-Z
$Console:Only
Dim Shared E
Type TestCase
file As String
expectedExtension As String
End Type
Dim tests(5) As TestCase
tests(1).file = "foobar.exe"
tests(1).expectedExtension = "exe"
tests(2).file = "foobar.EXE"
tests(2).expectedExtension = "EXE"
tests(3).file = "foobar."
tests(3).expectedExtension = ""
tests(4).file = "foobar"
tests(4).expectedExtension = ""
tests(5).file = "foobar.tar.gz"
tests(5).expectedExtension = "gz"
For i = 1 To UBOUND(tests)
result$ = GetFileExtension$(tests(i).file)
Print "Test"; i; ", Filename: "; tests(i).file
Print " Expected: "; tests(i).expectedExtension; ", Actual: "; result$
If result$ = tests(i).expectedExtension Then
Print " PASS!"
Else
Print " FAIL!"
End If
Next
done:
System
'These error handlers are not used in this progam, but are required
'for the functions included from file.bas
qberror:
Print " FAIL!"
Resume done
qberror_test:
E = 1
Resume Next
'$include:'../../../source/utilities/file.bas'