.autotest

git-svn-id: svn://ultimatepp.org/upp/trunk@7255 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-04-14 18:14:40 +00:00
parent 09eeb158b0
commit 1666fa0e0d
3 changed files with 18 additions and 0 deletions

View file

@ -5,6 +5,7 @@ uses
Skylark;
file
test2.witz,
index.witz,
etalon,
main.cpp;

View file

@ -30,6 +30,14 @@ struct MyApp : SkylarkApp {
}
};
Value WitzUrlEncode(const Vector<Value>& arg, const Renderer *) {
return arg.GetCount() == 1 && IsString(arg[0]) ? UrlEncode(arg[0]) : String();
}
INITBLOCK {
Compiler::Register("url_encode", WitzUrlEncode);
}
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_FILE|LOG_COUT);
@ -61,5 +69,13 @@ CONSOLE_APP_MAIN
LOG("------------");
// SaveFile(GetDataFile("etalon"), result);
ASSERT(result == LoadFile(GetDataFile("etalon")));
m.Add("name", "What is that?");
http("res", m);
result = http.RenderString("Witz/test2.witz");
ASSERT(result == "What+is+that%3F\r\n");
LOG(result);
LOG("========== OK");
}

1
autotest/Witz/test2.witz Normal file
View file

@ -0,0 +1 @@
$url_encode(res.name)