Skip to content

Commit

Permalink
chore(tests) auto-generated markup tests for all languages
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Nov 13, 2020
1 parent 9ba5a5d commit 17fc248
Show file tree
Hide file tree
Showing 212 changed files with 7,140 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/markup/1c/default.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<span class="hljs-meta">#<span class="hljs-meta-keyword">ЗагрузитьИзФайла</span> ext_module.txt <span class="hljs-comment">// директива 7.7</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">Если</span> <span class="hljs-meta-keyword">Клиент</span> <span class="hljs-meta-keyword">ИЛИ</span> <span class="hljs-meta-keyword">НаКлиенте</span> <span class="hljs-meta-keyword">Тогда</span> <span class="hljs-comment">// инструкции препроцессора</span></span>
<span class="hljs-meta">&amp;<span class="hljs-meta-keyword">НаКлиентеНаСервереБезКонтекста</span> <span class="hljs-comment">// директивы компиляции</span></span>
<span class="hljs-function">Функция <span class="hljs-title">ТолстыйКлиентОбычноеПриложение</span>(<span class="hljs-params"><span class="hljs-keyword">Знач</span> Параметр<span class="hljs-number">1</span> = <span class="hljs-literal">Неопределено</span></span>, <span class="hljs-comment">// комментарий</span>
<span class="hljs-params">Параметр2 = <span class="hljs-string">&quot;&quot;</span></span>, <span class="hljs-params">ПараметрN = <span class="hljs-number">123.45</span></span>, <span class="hljs-params">ПарамNN</span></span>) <span class="hljs-keyword">Экспорт</span> <span class="hljs-comment">// еще комментарий</span>
<span class="hljs-keyword">Попытка</span>
Результат_Булевы_Значения = <span class="hljs-keyword">Новый</span> <span class="hljs-type">Структура</span>(<span class="hljs-string">&quot;П1, П2&quot;</span>, <span class="hljs-literal">Истина</span>, <span class="hljs-literal">Ложь</span>, <span class="hljs-literal">NULL</span>, <span class="hljs-literal">Неопределено</span>);
<span class="hljs-keyword">Перейти</span> <span class="hljs-symbol">~МеткаGOTO</span>; <span class="hljs-comment">// комментарий</span>
РезультатТаблицаДат = <span class="hljs-keyword">Новый</span> <span class="hljs-type">ТаблицаЗначений</span>;
РезультатТаблицаДат.Колонки.Добавить(<span class="hljs-string">&quot;Колонка1&quot;</span>,
<span class="hljs-keyword">Новый</span> <span class="hljs-type">ОписаниеТипов</span>(<span class="hljs-string">&quot;Дата&quot;</span>, , ,
<span class="hljs-keyword">Новый</span> <span class="hljs-type">КвалификаторыДаты</span>(<span class="hljs-class">ЧастиДаты</span>.ДатаВремя));
НС = РезультатТаблицаДат.Добавить(); НС[<span class="hljs-string">&quot;Колонка1&quot;</span>] = &#x27;<span class="hljs-number">20170101120000</span>&#x27;);
<span class="hljs-keyword">Исключение</span>
<span class="hljs-built_in">ОписаниеОшибки</span> = <span class="hljs-built_in">ОписаниеОшибки</span>(); <span class="hljs-comment">// встроенная функция</span>
Масс = <span class="hljs-keyword">Новый</span> <span class="hljs-type">Массив</span>; <span class="hljs-comment">// встроенный тип</span>
<span class="hljs-keyword">Для</span> <span class="hljs-keyword">Каждого</span> Значение <span class="hljs-keyword">Из</span> Масс <span class="hljs-keyword">Цикл</span>
<span class="hljs-built_in">Сообщить</span>(Значение + <span class="hljs-class">Символы</span>.ПС + <span class="hljs-string">&quot;</span>
<span class="hljs-string">|продолжение строки&quot;</span>); <span class="hljs-comment">// продолжение многострочной строки</span>
<span class="hljs-keyword">Продолжить</span>; <span class="hljs-keyword">Прервать</span>;
<span class="hljs-keyword">КонецЦикла</span>;
СправочникСсылка = <span class="hljs-built_in">Справочники</span>.Языки.НайтиПоНаименованию(<span class="hljs-string">&quot;ru&quot;</span>); <span class="hljs-comment">// встроенные типы</span>
СправочникОбъект = СправочникСсылка.ПолучитьОбъект();
ПеречислениеСсылка = <span class="hljs-built_in">Перечисления</span>.ВидыМодификацииДанных.Изменен;
<span class="hljs-keyword">ВызватьИсключение</span> <span class="hljs-built_in">ОписаниеОшибки</span>;
<span class="hljs-keyword">КонецПопытки</span>;
<span class="hljs-symbol">~МеткаGOTO</span>: <span class="hljs-comment">// еще комментарий</span>
ВД = <span class="hljs-class">ВидДвиженияБухгалтерии</span>.Дебет;
<span class="hljs-function">КонецФункции</span> <span class="hljs-comment">// ТолстыйКлиентОбычноеПриложение()</span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">КонецЕсли</span></span>
30 changes: 30 additions & 0 deletions test/markup/1c/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ЗагрузитьИзФайла ext_module.txt // директива 7.7
#Если Клиент ИЛИ НаКлиенте Тогда // инструкции препроцессора
&НаКлиентеНаСервереБезКонтекста // директивы компиляции
Функция ТолстыйКлиентОбычноеПриложение(Знач Параметр1 = Неопределено, // комментарий
Параметр2 = "", ПараметрN = 123.45, ПарамNN) Экспорт // еще комментарий
Попытка
Результат_Булевы_Значения = Новый Структура("П1, П2", Истина, Ложь, NULL, Неопределено);
Перейти ~МеткаGOTO; // комментарий
РезультатТаблицаДат = Новый ТаблицаЗначений;
РезультатТаблицаДат.Колонки.Добавить("Колонка1",
Новый ОписаниеТипов("Дата", , ,
Новый КвалификаторыДаты(ЧастиДаты.ДатаВремя));
НС = РезультатТаблицаДат.Добавить(); НС["Колонка1"] = '20170101120000');
Исключение
ОписаниеОшибки = ОписаниеОшибки(); // встроенная функция
Масс = Новый Массив; // встроенный тип
Для Каждого Значение Из Масс Цикл
Сообщить(Значение + Символы.ПС + "
|продолжение строки"); // продолжение многострочной строки
Продолжить; Прервать;
КонецЦикла;
СправочникСсылка = Справочники.Языки.НайтиПоНаименованию("ru"); // встроенные типы
СправочникОбъект = СправочникСсылка.ПолучитьОбъект();
ПеречислениеСсылка = Перечисления.ВидыМодификацииДанных.Изменен;
ВызватьИсключение ОписаниеОшибки;
КонецПопытки;
~МеткаGOTO: // еще комментарий
ВД = ВидДвиженияБухгалтерии.Дебет;
КонецФункции // ТолстыйКлиентОбычноеПриложение()
#КонецЕсли
17 changes: 17 additions & 0 deletions test/markup/ada/default.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<span class="hljs-keyword">package</span> <span class="hljs-keyword">body</span> <span class="hljs-title">Sqlite.Simple </span><span class="hljs-keyword">is</span>

Foo : <span class="hljs-type">int</span> := int<span class="hljs-symbol">&#x27;Size</span>;
Bar : <span class="hljs-type">int</span> := long<span class="hljs-symbol">&#x27;Size</span>;

Error_Message_C : <span class="hljs-type">chars_ptr</span> := Sqlite_Errstr (Error);
Error_Message : <span class="hljs-type">String</span> := Null_Ignore_Value (Error_Message_C);
<span class="hljs-keyword">begin</span>

Named : <span class="hljs-keyword">for</span> Index <span class="hljs-keyword">in</span> Foo..Bar <span class="hljs-keyword">loop</span>
Put (<span class="hljs-string">&quot;Hi[]{}&quot;</span>);
<span class="hljs-keyword">end</span> <span class="hljs-keyword">loop</span> Named;

Foo := Bar;
<span class="hljs-keyword">end</span> Message;

<span class="hljs-keyword">end</span> Sqlite.Simple;
17 changes: 17 additions & 0 deletions test/markup/ada/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package body Sqlite.Simple is

Foo : int := int'Size;
Bar : int := long'Size;

Error_Message_C : chars_ptr := Sqlite_Errstr (Error);
Error_Message : String := Null_Ignore_Value (Error_Message_C);
begin

Named : for Index in Foo..Bar loop
Put ("Hi[]{}");
end loop Named;

Foo := Bar;
end Message;

end Sqlite.Simple;
62 changes: 62 additions & 0 deletions test/markup/angelscript/default.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<span class="hljs-keyword">interface</span> <span class="hljs-symbol">IInterface</span>
{
<span class="hljs-built_in">void</span> DoSomething();
}

<span class="hljs-keyword">namespace</span> <span class="hljs-symbol">MyApplication</span>
{
<span class="hljs-comment">/*
* This ia a test class.
*/</span>
<span class="hljs-keyword">class</span> <span class="hljs-symbol">SomeClass</span> : <span class="hljs-symbol">IInterface</span>
{
<span class="hljs-built_in">array<span class="hljs-keyword">&lt;<span class="hljs-built_in">float</span>&gt;</span></span> m_arr;

<span class="hljs-built_in">array<span class="hljs-keyword">&lt;<span class="hljs-symbol">SomeClass@</span>&gt;</span></span> m_children;
<span class="hljs-built_in">array<span class="hljs-keyword">&lt;<span class="hljs-built_in">array<span class="hljs-keyword">&lt;<span class="hljs-symbol">SomeClass@</span>&gt;</span></span>&gt;</span></span> m_subChildren; <span class="hljs-comment">// Nested templates</span>

<span class="hljs-built_in">int</span> m_thing;

SomeClass()
{
<span class="hljs-comment">// Add some integers</span>
m_arr.insertLast(<span class="hljs-number">1.0f</span>);
m_arr.insertLast(<span class="hljs-number">1.75f</span>);
m_arr.insertLast(<span class="hljs-number">3.14159f</span>);
<span class="hljs-built_in">uint</span> x = <span class="hljs-number">0x7fff0000</span>;
<span class="hljs-built_in">int</span> y = <span class="hljs-number">9001</span>;
<span class="hljs-built_in">uint</span> z = <span class="hljs-number">0b10101010</span>;
}

<span class="hljs-built_in">int</span> get_Thing() <span class="hljs-keyword">property</span> { <span class="hljs-keyword">return</span> m_thing; }
<span class="hljs-built_in">void</span> set_Thing(<span class="hljs-built_in">int</span> x) <span class="hljs-keyword">property</span> { m_thing = x; }
<span class="hljs-string">
[Hook x=1 y=2]</span>
<span class="hljs-built_in">void</span> DoSomething()
{
print(<span class="hljs-string">&quot;Something! &quot;</span> + <span class="hljs-string">&#x27;stuff.&#x27;</span>);
<span class="hljs-keyword">for</span> (<span class="hljs-built_in">uint</span> i = <span class="hljs-number">0</span>; i &lt; m_arr.length(); i++) {
print(<span class="hljs-string">&quot; &quot;</span> + i + <span class="hljs-string">&quot;: &quot;</span> + m_arr[i]);
}
}

<span class="hljs-keyword">protected</span> <span class="hljs-built_in">void</span> SomeProtectedFunction()
{
<span class="hljs-keyword">try</span> {
DoSomething();
} <span class="hljs-keyword">catch</span> {
print(<span class="hljs-string">&quot;Exception while doing something!&quot;</span>);
}
}
}
}

<span class="hljs-built_in">void</span> Main()
{
<span class="hljs-symbol">SomeClass@</span> c = SomeClass();
c.DoSomething();
}

<span class="hljs-built_in">string</span> multilineString = <span class="hljs-string">&quot;&quot;&quot;
Hello world, &quot;this is a test&quot;!
&quot;&quot;&quot;</span>;
62 changes: 62 additions & 0 deletions test/markup/angelscript/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
interface IInterface
{
void DoSomething();
}

namespace MyApplication
{
/*
* This ia a test class.
*/
class SomeClass : IInterface
{
array<float> m_arr;

array<SomeClass@> m_children;
array<array<SomeClass@>> m_subChildren; // Nested templates

int m_thing;

SomeClass()
{
// Add some integers
m_arr.insertLast(1.0f);
m_arr.insertLast(1.75f);
m_arr.insertLast(3.14159f);
uint x = 0x7fff0000;
int y = 9001;
uint z = 0b10101010;
}

int get_Thing() property { return m_thing; }
void set_Thing(int x) property { m_thing = x; }

[Hook x=1 y=2]
void DoSomething()
{
print("Something! " + 'stuff.');
for (uint i = 0; i < m_arr.length(); i++) {
print(" " + i + ": " + m_arr[i]);
}
}

protected void SomeProtectedFunction()
{
try {
DoSomething();
} catch {
print("Exception while doing something!");
}
}
}
}

void Main()
{
SomeClass@ c = SomeClass();
c.DoSomething();
}

string multilineString = """
Hello world, "this is a test"!
""";
19 changes: 19 additions & 0 deletions test/markup/apache/default.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<span class="hljs-comment"># rewrite`s rules for wordpress pretty url</span>
<span class="hljs-attribute"><span class="hljs-nomarkup">LoadModule</span></span> rewrite_module modules/mod_rewrite.so
<span class="hljs-attribute"><span class="hljs-nomarkup">RewriteCond</span></span> <span class="hljs-variable">%{REQUEST_FILENAME}</span> !-f
<span class="hljs-attribute"><span class="hljs-nomarkup">RewriteCond</span></span> <span class="hljs-variable">%{REQUEST_FILENAME}</span> !-d
<span class="hljs-attribute"><span class="hljs-nomarkup">RewriteRule</span></span> . index.php<span class="hljs-meta"> [NC,L]</span>

<span class="hljs-attribute">ExpiresActive</span> <span class="hljs-literal">On</span>
<span class="hljs-attribute">ExpiresByType</span> application/x-javascript <span class="hljs-string">&quot;access plus 1 days&quot;</span>

<span class="hljs-attribute"><span class="hljs-nomarkup">Order</span></span> <span class="hljs-literal">Deny</span>,<span class="hljs-literal">Allow</span>
<span class="hljs-attribute"><span class="hljs-nomarkup">Allow</span></span> from <span class="hljs-literal">All</span>

<span class="hljs-section">&lt;Location /maps/&gt;</span>
<span class="hljs-attribute">RewriteMap</span> map txt:map.txt
<span class="hljs-attribute">RewriteMap</span> lower int:tolower
<span class="hljs-attribute"><span class="hljs-nomarkup">RewriteCond</span></span> <span class="hljs-variable">%{REQUEST_URI}</span> ^/([^/.]+)\.html$<span class="hljs-meta"> [NC]</span>
<span class="hljs-attribute"><span class="hljs-nomarkup">RewriteCond</span></span> <span class="hljs-variable">${map:<span class="hljs-variable">${lower:<span class="hljs-number">%1</span>}</span>|NOT_FOUND}</span> !NOT_FOUND
<span class="hljs-attribute"><span class="hljs-nomarkup">RewriteRule</span></span> .? /index.php?q=<span class="hljs-variable">${map:<span class="hljs-variable">${lower:<span class="hljs-number">%1</span>}</span>}</span><span class="hljs-meta"> [NC,L]</span>
<span class="hljs-section">&lt;/Location&gt;</span>
19 changes: 19 additions & 0 deletions test/markup/apache/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# rewrite`s rules for wordpress pretty url
LoadModule rewrite_module modules/mod_rewrite.so
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [NC,L]

ExpiresActive On
ExpiresByType application/x-javascript "access plus 1 days"

Order Deny,Allow
Allow from All

<Location /maps/>
RewriteMap map txt:map.txt
RewriteMap lower int:tolower
RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC]
RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND
RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L]
</Location>
14 changes: 14 additions & 0 deletions test/markup/applescript/default.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<span class="hljs-keyword">repeat</span> <span class="hljs-number">5</span> <span class="hljs-keyword">times</span>
<span class="hljs-keyword">if</span> foo <span class="hljs-keyword">is</span> <span class="hljs-keyword">greater than</span> bar <span class="hljs-keyword">then</span>
<span class="hljs-built_in">display dialog</span> <span class="hljs-string">&quot;Hello there&quot;</span>
<span class="hljs-keyword">else</span>
<span class="hljs-built_in">beep</span>
<span class="hljs-keyword">end</span> <span class="hljs-keyword">if</span>
<span class="hljs-keyword">end</span> <span class="hljs-keyword">repeat</span>

<span class="hljs-comment">(* comment <span class="hljs-comment">(*nested comment*)</span> *)</span>
<span class="hljs-keyword">on</span> do_something(s, y)
<span class="hljs-built_in"> return</span> {s + <span class="hljs-literal">pi</span>, y <span class="hljs-keyword">mod</span> <span class="hljs-number">4</span>}
<span class="hljs-keyword">end</span> do_something

<span class="hljs-built_in">do shell script</span> <span class="hljs-string">&quot;/bin/echo &#x27;hello&#x27;&quot;</span>
14 changes: 14 additions & 0 deletions test/markup/applescript/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repeat 5 times
if foo is greater than bar then
display dialog "Hello there"
else
beep
end if
end repeat

(* comment (*nested comment*) *)
on do_something(s, y)
return {s + pi, y mod 4}
end do_something

do shell script "/bin/echo 'hello'"
Loading

0 comments on commit 17fc248

Please sign in to comment.