diff options
Diffstat (limited to 'tests/hawd/modules/check.cpp')
-rw-r--r-- | tests/hawd/modules/check.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/tests/hawd/modules/check.cpp b/tests/hawd/modules/check.cpp index 1359b3d..e334fb8 100644 --- a/tests/hawd/modules/check.cpp +++ b/tests/hawd/modules/check.cpp | |||
@@ -29,12 +29,30 @@ | |||
29 | namespace HAWD | 29 | namespace HAWD |
30 | { | 30 | { |
31 | 31 | ||
32 | CheckAll::CheckAll() | ||
33 | : Module() | ||
34 | { | ||
35 | setSyntax(Syntax("checkall", &CheckAll::check)); | ||
36 | } | ||
37 | |||
38 | bool CheckAll::check(const QStringList &commands, State &state) | ||
39 | { | ||
40 | QDir project(state.projectPath()); | ||
41 | project.setFilter(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot | QDir::NoSymLinks); | ||
42 | for (const QString &entry: project.entryList()) { | ||
43 | Check::checkFile(entry, state); | ||
44 | } | ||
45 | |||
46 | return true; | ||
47 | } | ||
48 | |||
32 | Check::Check() | 49 | Check::Check() |
33 | : Module() | 50 | : Module() |
34 | { | 51 | { |
35 | Syntax top("check", &Check::check); | 52 | Syntax top("check", &Check::check); |
36 | setDescription(QObject::tr("Checks a dataset description for validity and prints out any errors it finds")); | ||
37 | setSyntax(top); | 53 | setSyntax(top); |
54 | |||
55 | setDescription(QObject::tr("Checks a dataset description for validity and prints out any errors it finds")); | ||
38 | } | 56 | } |
39 | 57 | ||
40 | bool Check::check(const QStringList &commands, State &state) | 58 | bool Check::check(const QStringList &commands, State &state) |
@@ -43,15 +61,7 @@ bool Check::check(const QStringList &commands, State &state) | |||
43 | std::cout << QObject::tr("Please provide the name of a dataset definition file. (Use the 'list' command to see available datasets.)").toStdString() << std::endl; | 61 | std::cout << QObject::tr("Please provide the name of a dataset definition file. (Use the 'list' command to see available datasets.)").toStdString() << std::endl; |
44 | } else { | 62 | } else { |
45 | for (const QString &name: commands) { | 63 | for (const QString &name: commands) { |
46 | if (name == "*") { | 64 | checkFile(name, state); |
47 | QDir project(state.projectPath()); | ||
48 | project.setFilter(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot | QDir::NoSymLinks); | ||
49 | for (const QString &entry: project.entryList()) { | ||
50 | checkFile(entry, state); | ||
51 | } | ||
52 | } else { | ||
53 | checkFile(name, state); | ||
54 | } | ||
55 | } | 65 | } |
56 | } | 66 | } |
57 | 67 | ||