aboutsummaryrefslogtreecommitdiff
path: root/templates/qtest.sh
blob: 50d288c260c0f0dbeac7d6b058f50fa16e9d8ec6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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\"

// NOLINTBEGIN
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\"
// NOLINTEND
" > "./spec/${class_name}Spec.cpp"