From e27fb44592148f0eda88c0379fd13093e71c650b Mon Sep 17 00:00:00 2001 From: Elliot Fontaine <92150839+elliotfontaine@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:01:23 +0200 Subject: [PATCH] test: update tests --- test/corpus/comments.txt | 26 +++-- test/corpus/datetime.txt | 46 ++++++++- test/corpus/include-statements.txt | 19 ++-- test/corpus/jinja2.txt | 29 +++--- test/corpus/multilines-strings-2.txt | 35 ++++--- test/corpus/multilines-strings-3.txt | 35 ++++--- test/corpus/multilines-strings.txt | 24 +++-- test/corpus/quoted-strings.txt | 19 ++-- test/corpus/satellite-short.txt | 147 +++++++++++++++++++++++++++ test/corpus/sections.txt | 31 +++--- test/corpus/settings.txt | 36 ++++--- 11 files changed, 342 insertions(+), 105 deletions(-) create mode 100644 test/corpus/satellite-short.txt diff --git a/test/corpus/comments.txt b/test/corpus/comments.txt index 7260e12..3586cb1 100644 --- a/test/corpus/comments.txt +++ b/test/corpus/comments.txt @@ -1,26 +1,32 @@ -========||| +======== Comments -========||| +======== # Header comment [some-section] key = value [other-root] # a comment here ?! - just a key = with a value #and a comment without space + just a key = with a value # and a comment without space ----||| +--- -(configuration_file +(workflow_configuration (comment) - (root_section + (top_section name: (nametag) (setting key: (key) - value: (unquoted_string))) - (root_section + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content)))) + (top_section name: (nametag) (comment) (setting key: (key) - value: (unquoted_string))) - (comment)) + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content)) + (comment)))) diff --git a/test/corpus/datetime.txt b/test/corpus/datetime.txt index c9d78c3..9c0d9e5 100644 --- a/test/corpus/datetime.txt +++ b/test/corpus/datetime.txt @@ -1,6 +1,6 @@ -=================||| +================= ISO 8601 Datetime -=================||| +================= [section] datetime_extended1 = 2024-09-19T21:27:12Z @@ -13,6 +13,44 @@ datetime_extended7 = 2024-09-19T21:27+02:00 datetime_basic1 = 20240919T212712Z datetime_basic2 = 20240919T2127 ----||| +--- -TODO \ No newline at end of file +(workflow_configuration + (top_section + (nametag) + (setting + (key) + (assignment_operator) + (datetime)) + (setting + (key) + (assignment_operator) + (datetime)) + (setting + (key) + (assignment_operator) + (datetime)) + (setting + (key) + (assignment_operator) + (datetime)) + (setting + (key) + (assignment_operator) + (datetime)) + (setting + (key) + (assignment_operator) + (datetime)) + (setting + (key) + (assignment_operator) + (datetime)) + (setting + (key) + (assignment_operator) + (datetime)) + (setting + (key) + (assignment_operator) + (datetime)))) diff --git a/test/corpus/include-statements.txt b/test/corpus/include-statements.txt index c86d7eb..b12027d 100644 --- a/test/corpus/include-statements.txt +++ b/test/corpus/include-statements.txt @@ -1,6 +1,6 @@ -==================||| +================== Include Statements -==================||| +================== # Some header comment here. This is not an %include statement. %include "file.cylc" @@ -9,20 +9,25 @@ Include Statements [other-root] # a comment here ?! just a key = with a value ----||| +--- -(configuration_file +(workflow_configuration (comment) (include_statement + directive: (include_directive) path: (quoted_string)) - (root_section + (top_section name: (nametag)) (include_statement + directive: (include_directive) path: (quoted_string)) (comment) - (root_section + (top_section name: (nametag) (comment) (setting key: (key) - value: (unquoted_string)))) + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content))))) diff --git a/test/corpus/jinja2.txt b/test/corpus/jinja2.txt index 4c77610..23b3e33 100644 --- a/test/corpus/jinja2.txt +++ b/test/corpus/jinja2.txt @@ -1,6 +1,7 @@ -=======================================||| +======================================= Jinja2 (Statement, Expression, Comment) -=======================================||| +:skip +======================================= # {% stating something %} is for Statements # {{ expressing something }} is for Expressions @@ -16,37 +17,39 @@ Jinja2 (Statement, Expression, Comment) [[environment]] INFLUXDB_{{ param }}_TEST = 1{{ id_fragment }}8 INFLUXDB_V2_URL = {{ cfg__influxdb_url }} - INFLUXDB_V2_ORG = "org-{{ cfg__influxdb_org }}" + INFLUXDB_V2_ORG = "org-{{ cfg__influxdb_org }}-2" INFLUXDB_V2_TOKEN = {{ cfg__influxdb_auth_token }} ----||| +--- -(configuration_file +(workflow_configuration (comment (jinja2_statement)) (comment (jinja2_expression)) (comment (jinja2_comment)) - (root_section + (top_section name: (nametag) - (subsection_1 + (sub_section_1 name: (nametag) - (jinja2_statement) + (jinja2_statement) (setting key: (key) value: (unquoted_string)) - (jinja2_statement) + (jinja2_statement) (setting key: (key) value: (unquoted_string) (jinja2_expression))) - (jinja2_statement) - (subsection_1 + (jinja2_statement) + (sub_section_1 name: (nametag) (setting - key: (key (jinja2_expression)) - value: (number (jinja2_expression))) + key: (key + (jinja2_expression)) + value: (integer + (jinja2_expression))) (setting key: (key) (jinja2_expression)) diff --git a/test/corpus/multilines-strings-2.txt b/test/corpus/multilines-strings-2.txt index 468aa1a..e6b3720 100644 --- a/test/corpus/multilines-strings-2.txt +++ b/test/corpus/multilines-strings-2.txt @@ -1,6 +1,6 @@ -=======================||| +======================= Multi-lines Strings (2) -=======================||| +======================= [runtime] [[convert_raw]] @@ -14,18 +14,23 @@ Multi-lines Strings (2) [[[meta]]] title = Convert Raw ----||| +--- -(configuration_file - (root_section +(workflow_configuration + (top_section + name: (nametag) + (sub_section_1 + name: (nametag) + (setting + key: (key) + operator: (assignment_operator) + value: (multiline_string + (string_content))) + (sub_section_2 name: (nametag) - (subsection_1 - name: (nametag) - (setting - key: (key) - value: (multiline_string)) - (subsection_2 - name: (nametag) - (setting - key: (key) - value: (unquoted_string)))))) + (setting + key: (key) + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content))))))) diff --git a/test/corpus/multilines-strings-3.txt b/test/corpus/multilines-strings-3.txt index a242361..8bd47f7 100644 --- a/test/corpus/multilines-strings-3.txt +++ b/test/corpus/multilines-strings-3.txt @@ -1,6 +1,6 @@ -=======================||| +======================= Multi-lines Strings (3) -=======================||| +======================= [runtime] [[root]] @@ -14,18 +14,23 @@ Multi-lines Strings (3) [[[environment]]] USER_CONFIG_DIR = ${CYLC_WORKFLOW_RUN_DIR}/config ----||| +--- -(configuration_file - (root_section +(workflow_configuration + (top_section + name: (nametag) + (sub_section_1 + name: (nametag) + (setting + key: (key) + operator: (assignment_operator) + value: (multiline_string + (string_content))) + (sub_section_2 name: (nametag) - (subsection_1 - name: (nametag) - (setting - key: (key) - value: (multiline_string)) - (subsection_2 - name: (nametag) - (setting - key: (key) - value: (unquoted_string)))))) + (setting + key: (key) + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content))))))) diff --git a/test/corpus/multilines-strings.txt b/test/corpus/multilines-strings.txt index 1ee7c81..6d698c8 100644 --- a/test/corpus/multilines-strings.txt +++ b/test/corpus/multilines-strings.txt @@ -1,6 +1,6 @@ -===================||| +=================== Multi-lines Strings -===================||| +=================== [some-section] key = """ @@ -15,19 +15,25 @@ Multi-lines Strings value ''' ----||| +--- -(configuration_file - (root_section +(workflow_configuration + (top_section name: (nametag) (setting key: (key) - value: (multiline_string)) + operator: (assignment_operator) + value: (multiline_string + (string_content))) (setting key: (key) - value: (multiline_string))) - (root_section + operator: (assignment_operator) + value: (multiline_string + (string_content)))) + (top_section name: (nametag) (setting key: (key) - value: (multiline_string)))) + operator: (assignment_operator) + value: (multiline_string + (string_content))))) diff --git a/test/corpus/quoted-strings.txt b/test/corpus/quoted-strings.txt index a95b987..f4a8a6c 100644 --- a/test/corpus/quoted-strings.txt +++ b/test/corpus/quoted-strings.txt @@ -1,6 +1,6 @@ -==============||| +============== Quoted Strings -==============||| +============== [some-section] key="String is quoted." @@ -8,20 +8,23 @@ Quoted Strings [other-root] just a key = "Quote with 'single quotes' inside" ----||| +--- -(configuration_file - (root_section +(workflow_configuration + (top_section name: (nametag) (setting key: (key) + operator: (assignment_operator) value: (quoted_string)) (setting key: (key) - value: (quoted_string))) - (comment) - (root_section + operator: (assignment_operator) + value: (quoted_string) + (comment))) + (top_section name: (nametag) (setting key: (key) + operator: (assignment_operator) value: (quoted_string)))) diff --git a/test/corpus/satellite-short.txt b/test/corpus/satellite-short.txt new file mode 100644 index 0000000..16326ea --- /dev/null +++ b/test/corpus/satellite-short.txt @@ -0,0 +1,147 @@ +================ +Satellite short +================ + +#!Jinja2 + +[meta] + title=Real time satellite data processing demo, variant 3 of 3 + +{% set N_DATASETS = 5 %} + +[scheduling] + cycling mode = "integer" + initial cycle point = 12 + final cycle point ={{N_DATASETS}} + [[special_tasks]] + external-trigger = get_data("new dataset ready for processing. Total datasets: {{N_DATASETS}} ") + [[graph]] + R1 = prep => satsim & get_data # first cycle + P1 = """ + get_data => proc1 => proc2 => products # Processing chain for each dataset + get_data[-P1] => get_data # As one dataset is retrieved, start waiting on another. + """ + R1//{{N_DATASETS}} = products => collate # last cycle + +[runtime] + [[prep]] + script = """ + COUNT=0 + while true; do + """ + [[[meta]]] + title = clean the workflow output directories + +--- + +(workflow_configuration + (jinja2_shebang) + (top_section + name: (nametag) + (setting + key: (key) + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content + (jinja2_statement))))) + (top_section + name: (nametag) + (setting + key: (key) + operator: (assignment_operator) + value: (quoted_string)) + (setting + key: (key) + operator: (assignment_operator) + value: (integer)) + (setting + key: (key) + operator: (assignment_operator) + (jinja2_expression)) + (sub_section_1 + name: (nametag) + (setting + key: (key) + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content + (jinja2_expression))))) + (graph_section + name: (nametag) + (graph_setting + key: (recurrence) + operator: (assignment_operator) + value: (unquoted_graph_string + (graph_task + (nametag)) + (graph_arrow) + (graph_task + (nametag)) + (graph_logical) + (graph_task + (nametag))) + (comment)) + (graph_setting + key: (recurrence) + operator: (assignment_operator) + value: (multiline_graph_string + (unquoted_graph_string + (graph_task + (nametag))) + (unquoted_graph_string + (graph_arrow)) + (unquoted_graph_string + (graph_task + (nametag))) + (unquoted_graph_string + (graph_arrow)) + (unquoted_graph_string + (graph_task + (nametag))) + (unquoted_graph_string + (graph_arrow)) + (unquoted_graph_string + (graph_task + (nametag))) + (comment) + (unquoted_graph_string + (graph_task + (nametag) + (intercycle_annotation + (recurrence)))) + (unquoted_graph_string + (graph_arrow)) + (unquoted_graph_string + (graph_task + (nametag))) + (comment))) + (graph_setting + key: (recurrence) + (jinja2_expression) + operator: (assignment_operator) + value: (unquoted_graph_string + (graph_task + (nametag)) + (graph_arrow) + (graph_task + (nametag))) + (comment)))) + (top_section + name: (nametag) + (sub_section_1 + name: (nametag) + (setting + key: (key) + operator: (assignment_operator) + value: (multiline_string + (string_content))) + (sub_section_2 + name: (nametag) + (setting + key: (key) + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content))))))) diff --git a/test/corpus/sections.txt b/test/corpus/sections.txt index dc88f6d..4297989 100644 --- a/test/corpus/sections.txt +++ b/test/corpus/sections.txt @@ -1,6 +1,6 @@ -========================||| +======================== Sections and subsections -========================||| +======================== [some-section] key = value @@ -10,23 +10,30 @@ Sections and subsections [other-root] just a key = with a value ----||| +--- -(configuration_file - (root_section +(workflow_configuration + (top_section name: (nametag) (setting key: (key) - value: (unquoted_string)) - (subsection_1 + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content))) + (sub_section_1 name: (nametag) - (subsection_2 + (sub_section_2 name: (nametag) (setting - key: (key) - value: (number))))) - (root_section + key: (key) + operator: (assignment_operator) + value: (integer))))) + (top_section name: (nametag) (setting key: (key) - value: (unquoted_string)))) + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content))))) diff --git a/test/corpus/settings.txt b/test/corpus/settings.txt index efebdda..107ba6e 100644 --- a/test/corpus/settings.txt +++ b/test/corpus/settings.txt @@ -1,6 +1,6 @@ -========||| +======== Settings -========||| +======== [runtime] end = 100 @@ -12,33 +12,45 @@ Settings void = veritas = False #comment ----||| +--- -(configuration_file - (root_section +(workflow_configuration + (top_section name: (nametag) (setting key: (key) - value: (number)) + operator: (assignment_operator) + value: (integer)) (setting key: (key) - value: (unquoted_string)) + operator: (assignment_operator) + value: (unquoted_string + (string_content) + (string_content))) (setting key: (key) + operator: (assignment_operator) (jinja2_expression)) (setting key: (key) + operator: (assignment_operator) (jinja2_expression) - value: (unquoted_string)) + value: (unquoted_string + (string_content) + (string_content))) (setting key: (key) - value: (number)) + operator: (assignment_operator) + value: (integer)) (setting key: (key) + operator: (assignment_operator) value: (boolean)) (setting - key: (key)) + key: (key) + operator: (assignment_operator)) (setting key: (key) - value: (boolean))) - (comment)) + operator: (assignment_operator) + value: (boolean) + (comment))))