Changeset View
Changeset View
Standalone View
Standalone View
autotests/kshelltest.cpp
Show All 27 Lines | |||||
28 | #include <QDir> | 28 | #include <QDir> | ||
29 | 29 | | |||
30 | class KShellTest : public QObject | 30 | class KShellTest : public QObject | ||
31 | { | 31 | { | ||
32 | Q_OBJECT | 32 | Q_OBJECT | ||
33 | 33 | | |||
34 | private Q_SLOTS: | 34 | private Q_SLOTS: | ||
35 | void tildeExpand(); | 35 | void tildeExpand(); | ||
36 | void tildeCollapse(); | ||||
36 | void quoteArg(); | 37 | void quoteArg(); | ||
37 | void joinArgs(); | 38 | void joinArgs(); | ||
38 | void splitJoin(); | 39 | void splitJoin(); | ||
39 | void quoteSplit(); | 40 | void quoteSplit(); | ||
40 | void quoteSplit_data(); | 41 | void quoteSplit_data(); | ||
41 | void abortOnMeta(); | 42 | void abortOnMeta(); | ||
42 | }; | 43 | }; | ||
43 | 44 | | |||
Show All 18 Lines | |||||
62 | #ifdef Q_OS_WIN | 63 | #ifdef Q_OS_WIN | ||
63 | QCOMPARE(KShell::tildeExpand(QStringLiteral("^~") + me), QString(QLatin1Char('~') + me)); | 64 | QCOMPARE(KShell::tildeExpand(QStringLiteral("^~") + me), QString(QLatin1Char('~') + me)); | ||
64 | #else | 65 | #else | ||
65 | QCOMPARE(KShell::tildeExpand(QStringLiteral("\\~") + me), QString(QStringLiteral("~") + me)); | 66 | QCOMPARE(KShell::tildeExpand(QStringLiteral("\\~") + me), QString(QStringLiteral("~") + me)); | ||
66 | #endif | 67 | #endif | ||
67 | } | 68 | } | ||
68 | 69 | | |||
69 | void | 70 | void | ||
71 | KShellTest::tildeCollapse() | ||||
72 | { | ||||
73 | QCOMPARE(KShell::tildeCollapse(QDir::homePath()), QStringLiteral("~")); | ||||
74 | QCOMPARE(KShell::tildeCollapse(QDir::homePath() + QStringLiteral("/Documents")), QStringLiteral("~/Documents")); | ||||
75 | QCOMPARE(KShell::tildeCollapse(QStringLiteral("/test/") + QDir::homePath()), QStringLiteral("/test/") + QDir::homePath()); | ||||
76 | } | ||||
77 | | ||||
78 | void | ||||
70 | KShellTest::quoteArg() | 79 | KShellTest::quoteArg() | ||
71 | { | 80 | { | ||
72 | #ifdef Q_OS_WIN | 81 | #ifdef Q_OS_WIN | ||
73 | QCOMPARE(KShell::quoteArg(QStringLiteral("a space")), QStringLiteral("\"a space\"")); | 82 | QCOMPARE(KShell::quoteArg(QStringLiteral("a space")), QStringLiteral("\"a space\"")); | ||
74 | QCOMPARE(KShell::quoteArg(QStringLiteral("fds\\\"")), QStringLiteral("fds\\\\\\^\"")); | 83 | QCOMPARE(KShell::quoteArg(QStringLiteral("fds\\\"")), QStringLiteral("fds\\\\\\^\"")); | ||
75 | QCOMPARE(KShell::quoteArg(QStringLiteral("\\\\foo")), QStringLiteral("\\\\foo")); | 84 | QCOMPARE(KShell::quoteArg(QStringLiteral("\\\\foo")), QStringLiteral("\\\\foo")); | ||
76 | QCOMPARE(KShell::quoteArg(QStringLiteral("\"asdf\"")), QStringLiteral("\\^\"asdf\\^\"")); | 85 | QCOMPARE(KShell::quoteArg(QStringLiteral("\"asdf\"")), QStringLiteral("\\^\"asdf\\^\"")); | ||
77 | QCOMPARE(KShell::quoteArg(QStringLiteral("with\\")), QStringLiteral("\"with\\\\\"")); | 86 | QCOMPARE(KShell::quoteArg(QStringLiteral("with\\")), QStringLiteral("\"with\\\\\"")); | ||
▲ Show 20 Lines • Show All 176 Lines • Show Last 20 Lines |