diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch) | |
tree | 5ac38a06f3dde268dc7927dc155896926aaf7012 /kdecore/tests/kshelltest.cpp | |
download | tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/tests/kshelltest.cpp')
-rw-r--r-- | kdecore/tests/kshelltest.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/kdecore/tests/kshelltest.cpp b/kdecore/tests/kshelltest.cpp new file mode 100644 index 000000000..eaca1fcbe --- /dev/null +++ b/kdecore/tests/kshelltest.cpp @@ -0,0 +1,55 @@ +#include <kshell.h> + +#include <iostream> + +static QCString +ps(const QString &s) +{ + if (s.isNull()) + return "(null)"; + else + return s.local8Bit(); +} + +static void +tx(const char *t) +{ + std::cout << t << " -> " << ps(KShell::tildeExpand(t)) << std::endl; +} + +static void +sj(const char *t, int flg) +{ + int err; + std::cout << t << " (" << flg << ") -> " << ps(KShell::joinArgsDQ(KShell::splitArgs(t, flg, &err))) << " (" << err << ")" << std::endl; +} + +int main() +{ +#if 1 + tx("~"); + tx("~/sulli"); + tx("~root"); + tx("~root/sulli"); + tx("~sulli"); +#endif +#if 1 + QStringList lst; + lst << "this" << "is" << "text"; + std::cout << KShell::joinArgs(lst).latin1() << std::endl; +#endif +#if 1 + sj("\"~sulli\" 'text' 'jo'\"jo\" $'crap' $'\\\\\\'\\ca\\e\\x21' ha\\ lo ", KShell::NoOptions); + sj("\"~sulli\" 'text'", KShell::TildeExpand); + sj("~\"sulli\" 'text'", KShell::TildeExpand); + sj("~/\"sulli\" 'text'", KShell::TildeExpand); + sj("~ 'text' ~", KShell::TildeExpand); + sj("~sulli ~root", KShell::TildeExpand); +#endif + sj("say \" error", KShell::NoOptions); + sj("say `echo no error`", KShell::NoOptions); + sj("say \" still error", KShell::AbortOnMeta); + sj("say `echo meta error`", KShell::AbortOnMeta); + sj("BLA=say echo meta", KShell::AbortOnMeta); + sj("B\"L\"A=say FOO=bar echo meta", KShell::AbortOnMeta); +} |