aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rwxr-xr-xtemplates/qtest.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/templates/qtest.sh b/templates/qtest.sh
new file mode 100755
index 0000000..48a9f7d
--- /dev/null
+++ b/templates/qtest.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env sh
+
+set -e -o pipefail
+
+class_name="$1"
+[ -z "$class_name" ] && exit 1
+
+echo "#include <QtCore>
+#include \"testUtils.h\"
+
+#include \"$class_name.hpp\"
+
+class ${class_name}Spec : public QObject {
+ Q_OBJECT
+
+private slots:
+ void testThings() {
+ context(\"when initialized\");
+ it(\"does things\") {
+ $class_name instance;
+
+ QCOMPARE(1, 1);
+ }
+ }
+};
+
+QTEST_REGISTER(${class_name}Spec)
+#include \"${class_name}Spec.moc\"
+" > "./spec/${class_name}Spec.cpp"
+