From e16866e072f94410321d70daedbcb855ea878cac Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 6 Nov 2011 15:56:40 -0600 Subject: Actually move the kde files that were renamed in the last commit --- tdecore/tests/kshelltest.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tdecore/tests/kshelltest.cpp (limited to 'tdecore/tests/kshelltest.cpp') diff --git a/tdecore/tests/kshelltest.cpp b/tdecore/tests/kshelltest.cpp new file mode 100644 index 000000000..394394e28 --- /dev/null +++ b/tdecore/tests/kshelltest.cpp @@ -0,0 +1,55 @@ +#include + +#include + +static QCString +ps(const TQString &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 + TQStringList 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); +} -- cgit v1.2.1