diff options
Diffstat (limited to 'autotests/test_kconfigutils.cpp')
-rw-r--r-- | autotests/test_kconfigutils.cpp | 101 |
1 files changed, 30 insertions, 71 deletions
diff --git a/autotests/test_kconfigutils.cpp b/autotests/test_kconfigutils.cpp index 1e6c49f7..96959474 100644 --- a/autotests/test_kconfigutils.cpp +++ b/autotests/test_kconfigutils.cpp @@ -20,35 +20,16 @@ void TestKConfigUtils::testParseGroupString_data() QTest::addColumn<QStringList>("expected"); QTest::addColumn<bool>("expectedOk"); - QTest::newRow("simple-group") - << " group " - << (QStringList() << QStringLiteral("group")) - << true - ; - - QTest::newRow("sub-group") - << "[group][sub]" - << (QStringList() << QStringLiteral("group") << QStringLiteral("sub")) - << true - ; - - QTest::newRow("crazy-sub-group") - << "[a\\ttab\\x5d[and some hex esc\\x61pe]" - << (QStringList() << QStringLiteral("a\ttab") << QStringLiteral("and some hex escape")) - << true - ; - - QTest::newRow("missing-closing-brace") - << "[group][sub" - << QStringList() - << false - ; - - QTest::newRow("invalid-escape-string") - << "[a\\z]" - << QStringList() - << false - ; + QTest::newRow("simple-group") << " group " << (QStringList() << QStringLiteral("group")) << true; + + QTest::newRow("sub-group") << "[group][sub]" << (QStringList() << QStringLiteral("group") << QStringLiteral("sub")) << true; + + QTest::newRow("crazy-sub-group") << "[a\\ttab\\x5d[and some hex esc\\x61pe]" + << (QStringList() << QStringLiteral("a\ttab") << QStringLiteral("and some hex escape")) << true; + + QTest::newRow("missing-closing-brace") << "[group][sub" << QStringList() << false; + + QTest::newRow("invalid-escape-string") << "[a\\z]" << QStringList() << false; } void TestKConfigUtils::testParseGroupString() @@ -76,47 +57,26 @@ void TestKConfigUtils::testUnescapeString_data() QTest::addColumn<QString>("expected"); QTest::addColumn<bool>("expectedOk"); - QTest::newRow("plain") - << "Some text" - << "Some text" - << true - ; - - QTest::newRow("single-char-escapes") - << "01\\s23\\t45\\n67\\r89\\\\" - << "01 23\t45\n67\r89\\" - << true - ; - - QTest::newRow("hex-escapes") - << "kd\\x65" - << "kde" - << true - ; - - QTest::newRow("unfinished-hex-escape") - << "kd\\x6" - << "" - << false - ; - - QTest::newRow("invalid-hex-escape") - << "kd\\xzz" - << "" - << false - ; - - QTest::newRow("invalid-escape-sequence") - << "Foo\\a" - << "" - << false - ; - - QTest::newRow("unfinished-escape-sequence") - << "Foo\\" - << "" - << false - ; + QTest::newRow("plain") << "Some text" + << "Some text" << true; + + QTest::newRow("single-char-escapes") << "01\\s23\\t45\\n67\\r89\\\\" + << "01 23\t45\n67\r89\\" << true; + + QTest::newRow("hex-escapes") << "kd\\x65" + << "kde" << true; + + QTest::newRow("unfinished-hex-escape") << "kd\\x6" + << "" << false; + + QTest::newRow("invalid-hex-escape") << "kd\\xzz" + << "" << false; + + QTest::newRow("invalid-escape-sequence") << "Foo\\a" + << "" << false; + + QTest::newRow("unfinished-escape-sequence") << "Foo\\" + << "" << false; } void TestKConfigUtils::testUnescapeString() @@ -137,4 +97,3 @@ void TestKConfigUtils::testUnescapeString() qDebug() << error; } } - |