From 2def01e680a202d4179b4e4f77f6d0be8b254123 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 22 Feb 2021 09:05:35 +0000 Subject: [PATCH] .autotest git-svn-id: svn://ultimatepp.org/upp/trunk@15790 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- autotest/UppHub/UppHub.cpp | 12 +++-- autotest/Witz/Witz.upp | 16 ------- autotest/Witz/etalon | 18 -------- autotest/Witz/index.witz | 20 --------- autotest/Witz/index2.witz | 20 --------- autotest/Witz/main.cpp | 91 -------------------------------------- autotest/Witz/test2.witz | 1 - 7 files changed, 5 insertions(+), 173 deletions(-) delete mode 100644 autotest/Witz/Witz.upp delete mode 100644 autotest/Witz/etalon delete mode 100644 autotest/Witz/index.witz delete mode 100644 autotest/Witz/index2.witz delete mode 100644 autotest/Witz/main.cpp delete mode 100644 autotest/Witz/test2.witz diff --git a/autotest/UppHub/UppHub.cpp b/autotest/UppHub/UppHub.cpp index 7f48fa241..6c2b5674b 100644 --- a/autotest/UppHub/UppHub.cpp +++ b/autotest/UppHub/UppHub.cpp @@ -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"); } diff --git a/autotest/Witz/Witz.upp b/autotest/Witz/Witz.upp deleted file mode 100644 index 9e97bfec9..000000000 --- a/autotest/Witz/Witz.upp +++ /dev/null @@ -1,16 +0,0 @@ -description "Witz templates\377"; - -uses - Core, - Skylark; - -file - test2.witz, - index.witz, - index2.witz, - etalon, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/autotest/Witz/etalon b/autotest/Witz/etalon deleted file mode 100644 index fb1af36c7..000000000 --- a/autotest/Witz/etalon +++ /dev/null @@ -1,18 +0,0 @@ -first value - -1 -Hello - - -Skylark test -# -"Skylark test" -#TITLE -#TITLE2 -## -## -

Skylark test

-some text -[ Skylark test Skylark test #NESTED ] -#aafe45 - diff --git a/autotest/Witz/index.witz b/autotest/Witz/index.witz deleted file mode 100644 index 94e957596..000000000 --- a/autotest/Witz/index.witz +++ /dev/null @@ -1,20 +0,0 @@ -$MyMap["key1"] -$MyMap[1] -$MyArray[0] -$MyArray[1] -$MyArray[123] -$MyArray["hello"] -#TITLE -# -"#TITLE" -##TITLE -#TITLE2 -### -#### -

#TITLE

-some text -#NESTED -#aafe45 - -#define TITLE Skylark test -#define NESTED [ #TITLE #TITLE #NESTED ] diff --git a/autotest/Witz/index2.witz b/autotest/Witz/index2.witz deleted file mode 100644 index cdb63b0fd..000000000 --- a/autotest/Witz/index2.witz +++ /dev/null @@ -1,20 +0,0 @@ -$MyMap["key1"] -$MyMap[1] -$MyArray[0] -$MyArray[1] -$MyArray[123] -$MyArray["hello"] -#TITLE -# -"#TITLE" -##TITLE -#TITLE2 -### -#### -

#TITLE

-some text -#NESTED -#aafe45 $(x+) - -#define TITLE Skylark test -#define NESTED [ #TITLE #TITLE #NESTED ] diff --git a/autotest/Witz/main.cpp b/autotest/Witz/main.cpp deleted file mode 100644 index 48cdc1076..000000000 --- a/autotest/Witz/main.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include - -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("raw html")) - ("MyRawValue2", "another raw html") - ("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& 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("raw html")) - ("MyRawValue2", "another raw html") - ("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") >= 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"); -} diff --git a/autotest/Witz/test2.witz b/autotest/Witz/test2.witz deleted file mode 100644 index bbba029d1..000000000 --- a/autotest/Witz/test2.witz +++ /dev/null @@ -1 +0,0 @@ -$url_encode(res.name) \ No newline at end of file