mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-09 14:00:17 +00:00
Current the -o flag will strip any "extension" on the provided filename, which is fairly problimatic on Linux and Mac OS since those executes do not have other extensions and names like "foobar.v1" will get the ".v1" stripped off. This can happen on Windows as well if you leave off the .exe (QB64-PE will add it for you, but also strip off the existing extension). QB64-PE stripping off the ".exe" when provided that on Linux and Mac OS might actually be useful behavior people are relying on (so that they don't need to provide different names when compiling on Linux/Mac OS) so we are preserving that and still removing the extension if it is exactly "EXE", otherwise we now leave it in place. Fixes: #297
41 lines
832 B
QBasic
41 lines
832 B
QBasic
DEFLNG A-Z
|
|
$Console:Only
|
|
|
|
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
|
|
|
|
System
|
|
|
|
'$include:'../../../source/utilities/file.bas'
|