diff --git a/.gitattributes b/.gitattributes
index 8fc0cd0e65..8978e9b771 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3636,6 +3636,7 @@ test/bugs/8450/unit1.lfm svneol=native#text/plain
test/bugs/8450/unit1.lrs svneol=native#text/plain
test/bugs/8450/unit1.pas svneol=native#text/plain
test/bugs/bug8432.pas svneol=native#text/plain
+test/bugs/testfileproc.pas svneol=native#text/plain
test/bugs/testfileutil.pas svneol=native#text/plain
test/bugtestcase.pas svneol=native#text/plain
test/hello.ahk svneol=native#text/plain
diff --git a/test/bugs/testfileproc.pas b/test/bugs/testfileproc.pas
new file mode 100644
index 0000000000..3206e31ab3
--- /dev/null
+++ b/test/bugs/testfileproc.pas
@@ -0,0 +1,54 @@
+unit testfileproc;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, fpcunit, testglobals,
+ FileProcs;
+
+type
+
+ { TTestFileUtil }
+
+ TTestFileProc= class(TTestCase)
+ published
+ procedure TestFileIsExecutable;
+ procedure TestTrimFileName;
+ end;
+
+implementation
+
+{ TTestFileProc }
+
+procedure TTestFileProc.TestFileIsExecutable;
+ procedure DoTest(const AFileName: string; Expected: boolean);
+ begin
+ AssertEquals(AFileName, Expected, FileIsExecutable(AFileName));
+ end;
+begin
+ DoTest(ParamStr(0),true);
+ // a directory is not an executable file
+ DoTest(ExtractFileDir(ParamStr(0)), false);
+end;
+
+procedure TTestFileProc.TestTrimFileName;
+ procedure DoTest(AFileName, Expected: string);
+ begin
+ DoDirSeparators(AFileName);
+ DoDirSeparators(Expected);
+ AssertEquals(AFileName, Expected, TrimFilename(AFileName));
+ end;
+begin
+{$ifdef windows}
+ DoTest('c:\LazarusDir\..\dir\','c:\dir\');
+{$endif}
+ DoTest('$(LazarusDir)\..\dir\','$(LazarusDir)\..\dir\');
+end;
+
+initialization
+ // TODO: Maybe this test case should be moved to another testsuite, e.g. codetools test
+ AddToBugsTestSuite(TTestSuite.Create(TTestFileProc, 'TestFileProc'));
+end.
+
diff --git a/test/bugs/testfileutil.pas b/test/bugs/testfileutil.pas
index d301a05077..2d96d3ccc3 100644
--- a/test/bugs/testfileutil.pas
+++ b/test/bugs/testfileutil.pas
@@ -16,6 +16,7 @@ type
published
procedure TestFileIsExecutable;
procedure TestExtractFileNameWithoutExt;
+ procedure TestTrimFileName;
end;
implementation
@@ -48,6 +49,20 @@ begin
DoTest(DirName + 'test.pas.bak', DirName + 'test');
end;
+procedure TTestFileUtil.TestTrimFileName;
+ procedure DoTest(AFileName, Expected: string);
+ begin
+ DoDirSeparators(AFileName);
+ DoDirSeparators(Expected);
+ AssertEquals(AFileName, Expected, TrimFilename(AFileName));
+ end;
+begin
+{$ifdef windows}
+ DoTest('c:\LazarusDir\..\dir\','c:\dir\');
+{$endif}
+ DoTest('$(LazarusDir)\..\dir\','$(LazarusDir)\..\dir\');
+end;
+
initialization
// Maybe this test case should be moved to another testsuite, e.g. lcl test
AddToBugsTestSuite(TTestSuite.Create(TTestFileUtil, 'TestFileUtil'));
diff --git a/test/runtests.lpi b/test/runtests.lpi
index 6e7ff3fed6..8ae66fc92b 100644
--- a/test/runtests.lpi
+++ b/test/runtests.lpi
@@ -21,16 +21,19 @@
-
+
-
+
-
+
-
+
+
+
+
diff --git a/test/runtestsgui.lpi b/test/runtestsgui.lpi
index 0e5684c592..955a80bc87 100644
--- a/test/runtestsgui.lpi
+++ b/test/runtestsgui.lpi
@@ -21,18 +21,21 @@
-
+
-
+
-
+
-
+
+
+
+
-
+
@@ -63,6 +66,11 @@
+
+
+
+
+
diff --git a/test/testunits.pas b/test/testunits.pas
index c0d2a4b668..6552b09379 100644
--- a/test/testunits.pas
+++ b/test/testunits.pas
@@ -28,7 +28,7 @@ interface
uses
TestLpi, BugTestCase,
- bug8432, testfileutil;
+ bug8432, testfileutil, testfileproc;
implementation