-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set(CMAKE_AUTOMOC ON) | ||
|
||
add_executable(test_utility_paths test_paths.cpp) | ||
target_link_libraries(test_utility_paths PRIVATE Qt5::Test utility) | ||
add_test(NAME test_utility_paths COMMAND test_utility_paths) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "shared.h" | ||
|
||
#include <QtTest> | ||
|
||
/** | ||
* Tests functions acting on paths | ||
*/ | ||
class test_paths : public QObject { | ||
Q_OBJECT | ||
|
||
private slots: | ||
void is_safe_filename(); | ||
}; | ||
|
||
/** | ||
* Tests \ref ::is_safe_filename | ||
*/ | ||
void test_paths::is_safe_filename() | ||
{ | ||
QCOMPARE(::is_safe_filename(QLatin1String("")), false); | ||
QCOMPARE(::is_safe_filename(QLatin1String("abcABC_-._")), true); | ||
QCOMPARE(::is_safe_filename(QLatin1String("a/b")), false); | ||
QCOMPARE(::is_safe_filename(QLatin1String("..")), false); | ||
} | ||
|
||
QTEST_MAIN(test_paths) | ||
#include "test_paths.moc" |