File: namevalidatortest.cpp

package info (click to toggle)
kapptemplate 4%3A25.12.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,036 kB
  • sloc: cpp: 1,009; xml: 481; sh: 7; makefile: 3
file content (26 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (2)
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
/*
    SPDX-FileCopyrightText: 2008 Anne-Marie Mahfouf <annma@kde.org>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

#include <QRegularExpression>
#include <QString>
#include <QTest>

#include "namevalidatortest.h"

// This is a test to check the validity of the validator we use
// for entering a project application name. Foreign characters should be excluded
// as well as weird characters except _ . and -
void NameValidatorTest::testAppName()
{
    QRegularExpression rx("^[a-zA-Z0-9_.\\-]*$");
    QString myAppName = "KTry_App-0.1";
    QRegularExpressionMatch match = rx.match(myAppName);
    QVERIFY(match.hasMatch());
}

QTEST_MAIN(NameValidatorTest)

#include "moc_namevalidatortest.cpp"