Freeciv21
Develop your civilization from humble roots to a global empire
test_paths.cpp
Go to the documentation of this file.
1
#include "
shared.h
"
2
3
#include <QtTest>
4
8
class
test_paths
:
public
QObject {
9
Q_OBJECT
10
11
private
slots:
12
void
interpret_tilde
();
13
void
is_safe_filename
();
14
void
make_dir
();
15
};
16
20
void
test_paths::interpret_tilde
()
21
{
22
QCOMPARE(::
interpret_tilde
(QLatin1String(
"~"
)), QDir::homePath());
23
QCOMPARE(::
interpret_tilde
(QLatin1String(
"test"
)), QLatin1String(
"test"
));
24
}
25
29
void
test_paths::is_safe_filename
()
30
{
31
QCOMPARE(::
is_safe_filename
(QLatin1String(
""
)),
false
);
32
QCOMPARE(::
is_safe_filename
(QLatin1String(
"abcABC_-._"
)),
true
);
33
QCOMPARE(::
is_safe_filename
(QLatin1String(
"a/b"
)),
false
);
34
QCOMPARE(::
is_safe_filename
(QLatin1String(
".."
)),
false
);
35
}
36
40
void
test_paths::make_dir
()
41
{
42
// The main difference between make_dir and QDir()::mkpath is that make_dir
43
// ignores empty paths. We don't check that QDir works as expected.
44
QVERIFY(::
make_dir
(QLatin1String(
""
)));
45
}
46
47
QTEST_MAIN(
test_paths
)
48
#include "test_paths.moc"
test_paths
Tests functions acting on paths.
Definition:
test_paths.cpp:8
test_paths::interpret_tilde
void interpret_tilde()
Tests interpret_tilde.
Definition:
test_paths.cpp:20
test_paths::make_dir
void make_dir()
Tests make_dir.
Definition:
test_paths.cpp:40
test_paths::is_safe_filename
void is_safe_filename()
Tests is_safe_filename.
Definition:
test_paths.cpp:29
shared.h
utility
tests
test_paths.cpp
Generated by
1.9.1