summaryrefslogtreecommitdiff
path: root/tests/utils.cpp
blob: fcf63afb033698a2be7ba41a8600cf142f8b8912 (plain)
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
33
34
#include <QtTest/QtTest>

#include <TelepathyQt/Utils>

using namespace Tp;

class TestUtils : public QObject
{
    Q_OBJECT

private Q_SLOTS:
    void testUtils();
};

void TestUtils::testUtils()
{
  QString res;

  res = escapeAsIdentifier(QString::fromLatin1(""));
  QCOMPARE(res, QString::fromLatin1("_"));

  res = escapeAsIdentifier(QString::fromLatin1("badger"));
  QCOMPARE(res, QString::fromLatin1("badger"));

  res = escapeAsIdentifier(QString::fromLatin1("0123abc_xyz"));
  QCOMPARE(res, QString::fromLatin1("_30123abc_5fxyz"));

  res = escapeAsIdentifier(QString::fromUtf8("©"));
  QCOMPARE(res, QString::fromLatin1("_c2_a9"));
}

QTEST_MAIN(TestUtils)

#include "_gen/utils.cpp.moc.hpp"