aboutsummaryrefslogtreecommitdiffstats
path: root/dev-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'dev-scripts')
-rwxr-xr-xdev-scripts/generate.py20
-rw-r--r--dev-scripts/templates/test-config.json7
-rw-r--r--dev-scripts/templates/test-main.cpp6
3 files changed, 33 insertions, 0 deletions
diff --git a/dev-scripts/generate.py b/dev-scripts/generate.py
index 7d6668df..9ff6eb49 100755
--- a/dev-scripts/generate.py
+++ b/dev-scripts/generate.py
@@ -25,6 +25,7 @@ _license_text = \
"""
import sys, os, json, argparse
+from shutil import copyfile
CHECKS_FILENAME = 'checks.json'
_checks = []
@@ -293,6 +294,24 @@ def create_readmes(checks):
f.close()
print("Created " + check.readme_path())
#-------------------------------------------------------------------------------
+def create_unittests(checks):
+ for check in checks:
+ unittest_folder = clazy_source_path() + "tests/" + check.name
+ if not os.path.exists(unittest_folder):
+ os.mkdir(unittest_folder)
+ print("Created " + unittest_folder)
+
+ configjson_file = unittest_folder + "/config.json"
+ if not os.path.exists(configjson_file):
+ copyfile(templates_path() + "test-config.json", configjson_file)
+ print("Created " + configjson_file)
+
+ testmain_file = unittest_folder + "/main.cpp"
+ if not os.path.exists(testmain_file) and check.name != 'non-pod-global-static':
+ copyfile(templates_path() + "test-main.cpp", testmain_file)
+ print("Created " + testmain_file)
+
+#-------------------------------------------------------------------------------
def generate_readme(checks):
filename = clazy_source_path() + "README.md"
@@ -350,5 +369,6 @@ if args.generate:
generate_cmake_file(_checks)
generate_readme(_checks)
create_readmes(_checks)
+ create_unittests(_checks)
else:
parser.print_help(sys.stderr)
diff --git a/dev-scripts/templates/test-config.json b/dev-scripts/templates/test-config.json
new file mode 100644
index 00000000..e7e6e0cb
--- /dev/null
+++ b/dev-scripts/templates/test-config.json
@@ -0,0 +1,7 @@
+{
+ "tests" : [
+ {
+ "filename" : "main.cpp"
+ }
+ ]
+}
diff --git a/dev-scripts/templates/test-main.cpp b/dev-scripts/templates/test-main.cpp
new file mode 100644
index 00000000..5ca75994
--- /dev/null
+++ b/dev-scripts/templates/test-main.cpp
@@ -0,0 +1,6 @@
+#include <QtCore/QObject>
+#include <QtCore/QString>
+
+void test()
+{
+}