mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@15790 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
3bbc75be31
commit
2def01e680
7 changed files with 5 additions and 173 deletions
|
|
@ -4,16 +4,12 @@ using namespace Upp;
|
|||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
HttpRequest r("https://raw.githubusercontent.com/ultimatepp/UppHub/main/README.md");
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
HttpRequest r("https://raw.githubusercontent.com/ultimatepp/UppHub/main/nests.json");
|
||||
|
||||
String s = r.Execute();
|
||||
|
||||
int begin = s.FindAfter("UPPHUB_BEGIN");
|
||||
int end = s.Find("UPPHUB_END");
|
||||
|
||||
if(begin >= 0 && end >= 0)
|
||||
s = s.Mid(begin, end - begin);
|
||||
|
||||
Value v = ParseJSON(s);
|
||||
if(v.IsError()) {
|
||||
s.Replace(""", "\"");
|
||||
|
|
@ -22,4 +18,6 @@ CONSOLE_APP_MAIN
|
|||
}
|
||||
|
||||
ASSERT(!v.IsError());
|
||||
|
||||
LOG("========== OK");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
description "Witz templates\377";
|
||||
|
||||
uses
|
||||
Core,
|
||||
Skylark;
|
||||
|
||||
file
|
||||
test2.witz,
|
||||
index.witz,
|
||||
index2.witz,
|
||||
etalon,
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "MT";
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
first value
|
||||
|
||||
1
|
||||
Hello
|
||||
|
||||
|
||||
<title>Skylark test</title>
|
||||
#
|
||||
"Skylark test"
|
||||
#TITLE
|
||||
#TITLE2
|
||||
##
|
||||
##
|
||||
<h1>Skylark test</h1>
|
||||
some text
|
||||
[ Skylark test Skylark test #NESTED ]
|
||||
#aafe45
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
$MyMap["key1"]
|
||||
$MyMap[1]
|
||||
$MyArray[0]
|
||||
$MyArray[1]
|
||||
$MyArray[123]
|
||||
$MyArray["hello"]
|
||||
<title>#TITLE</title>
|
||||
#
|
||||
"#TITLE"
|
||||
##TITLE
|
||||
#TITLE2
|
||||
###
|
||||
####
|
||||
<h1>#TITLE</h1>
|
||||
some text
|
||||
#NESTED
|
||||
#aafe45
|
||||
|
||||
#define TITLE Skylark test
|
||||
#define NESTED [ #TITLE #TITLE #NESTED ]
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
$MyMap["key1"]
|
||||
$MyMap[1]
|
||||
$MyArray[0]
|
||||
$MyArray[1]
|
||||
$MyArray[123]
|
||||
$MyArray["hello"]
|
||||
<title>#TITLE</title>
|
||||
#
|
||||
"#TITLE"
|
||||
##TITLE
|
||||
#TITLE2
|
||||
###
|
||||
####
|
||||
<h1>#TITLE</h1>
|
||||
some text
|
||||
#NESTED
|
||||
#aafe45 $(x+)
|
||||
|
||||
#define TITLE Skylark test
|
||||
#define NESTED [ #TITLE #TITLE #NESTED ]
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
#include <Skylark/Skylark.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
SKYLARK(HomePage, "")
|
||||
{
|
||||
ValueArray va;
|
||||
va.Add(1);
|
||||
va.Add("Hello");
|
||||
ValueMap m;
|
||||
m.Add("key1", "first value");
|
||||
m.Add("key2", "second value");
|
||||
|
||||
http("MyValue", "some value")
|
||||
("MyRawValue", Raw("<b>raw <u>html</u></b>"))
|
||||
("MyRawValue2", "<b>another raw <u>html</u></b>")
|
||||
("MyArray", va)
|
||||
("MyMap", m)
|
||||
.RenderResult("Skylark02/index");
|
||||
}
|
||||
|
||||
struct MyApp : SkylarkApp {
|
||||
MyApp() {
|
||||
root = "myapp";
|
||||
#ifdef _DEBUG
|
||||
prefork = 0;
|
||||
use_caching = false;
|
||||
#endif
|
||||
path = GetFileFolder(GetFileFolder(GetDataFile("x")));
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
Ini::skylark_log = true;
|
||||
|
||||
MyApp app;
|
||||
|
||||
LOG("PATH: " << app.Config().path);
|
||||
LOG("--------------------------------------------");
|
||||
|
||||
Renderer http;
|
||||
ValueArray va;
|
||||
va.Add(1);
|
||||
va.Add("Hello");
|
||||
ValueMap m;
|
||||
m.Add("key1", "first value");
|
||||
m.Add("key2", "second value");
|
||||
|
||||
http("MyValue", "some value")
|
||||
("MyRawValue", Raw("<b>raw <u>html</u></b>"))
|
||||
("MyRawValue2", "<b>another raw <u>html</u></b>")
|
||||
("MyArray", va)
|
||||
("MyMap", m);
|
||||
|
||||
String result = http.RenderString("Witz/index");
|
||||
|
||||
LOG("------------");
|
||||
LOG(result);
|
||||
LOG("------------");
|
||||
// SaveFile(GetDataFile("etalon"), result);
|
||||
ASSERT(result == LoadFile(GetDataFile("etalon")));
|
||||
|
||||
result = http.RenderString("Witz/index2");
|
||||
|
||||
LOG("------------");
|
||||
LOG(result);
|
||||
LOG("------------");
|
||||
// SaveFile(GetDataFile("etalon"), result);
|
||||
|
||||
ASSERT(result.Find("autotest/Witz/index2.witz(17,13): missing number</body></html>") >= 0);
|
||||
|
||||
|
||||
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 +0,0 @@
|
|||
$url_encode(res.name)
|
||||
Loading…
Add table
Add a link
Reference in a new issue