From ff1b90a4f4aec4d374261adda460ddc1d83c5ddd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 1 Dec 2014 20:26:07 +0100 Subject: mds-kbdc: m + more test cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .../mds-kbdc/validate-tree/invalid/for-return | 13 ++++++ .../mds-kbdc/validate-tree/invalid/if-else-break | 22 +++++++++++ .../validate-tree/invalid/misplaced_assumption | 46 ++++++++++++++++++++++ .../validate-tree/invalid/misplaced_information | 38 ++++++++++++++++++ .../mds-kbdc/validate-tree/invalid/runaway_break | 7 ++++ .../validate-tree/invalid/runaway_continue | 7 ++++ test-files/mds-kbdc/validate-tree/valid/assumption | 18 +++++++++ test-files/mds-kbdc/validate-tree/valid/for-break | 10 +++++ .../mds-kbdc/validate-tree/valid/for-continue | 10 +++++ .../mds-kbdc/validate-tree/valid/for-for-end-break | 15 +++++++ .../mds-kbdc/validate-tree/valid/function-return | 10 +++++ .../mds-kbdc/validate-tree/valid/information | 14 +++++++ .../mds-kbdc/validate-tree/valid/macro-return | 10 +++++ 13 files changed, 220 insertions(+) create mode 100644 test-files/mds-kbdc/validate-tree/invalid/for-return create mode 100644 test-files/mds-kbdc/validate-tree/invalid/if-else-break create mode 100644 test-files/mds-kbdc/validate-tree/invalid/misplaced_assumption create mode 100644 test-files/mds-kbdc/validate-tree/invalid/misplaced_information create mode 100644 test-files/mds-kbdc/validate-tree/invalid/runaway_break create mode 100644 test-files/mds-kbdc/validate-tree/invalid/runaway_continue create mode 100644 test-files/mds-kbdc/validate-tree/valid/assumption create mode 100644 test-files/mds-kbdc/validate-tree/valid/for-break create mode 100644 test-files/mds-kbdc/validate-tree/valid/for-continue create mode 100644 test-files/mds-kbdc/validate-tree/valid/for-for-end-break create mode 100644 test-files/mds-kbdc/validate-tree/valid/function-return create mode 100644 test-files/mds-kbdc/validate-tree/valid/information create mode 100644 test-files/mds-kbdc/validate-tree/valid/macro-return (limited to 'test-files/mds-kbdc/validate-tree') diff --git a/test-files/mds-kbdc/validate-tree/invalid/for-return b/test-files/mds-kbdc/validate-tree/invalid/for-return new file mode 100644 index 0000000..af59736 --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/invalid/for-return @@ -0,0 +1,13 @@ +for 1 to 9 as \1 + return +end for + +# (for (@ 1 0-3) ‘1’ ‘9’ (.variable ‘\1’) +# (.inner +# (return (@ 2 2-8)) +# ) +# ) +# :2:2–8: error: ‘return’ outside function and macro definition +# return +# ^^^^^^ + diff --git a/test-files/mds-kbdc/validate-tree/invalid/if-else-break b/test-files/mds-kbdc/validate-tree/invalid/if-else-break new file mode 100644 index 0000000..0e8ae81 --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/invalid/if-else-break @@ -0,0 +1,22 @@ +if 1 + if 0 + else + break + end if +end if + +# (if (@ 1 0-2) ‘1’ +# (.inner +# (if (@ 2 2-4) ‘0’ +# (.inner nil) +# (.otherwise +# (break (@ 4 4-9)) +# ) +# ) +# ) +# (.otherwise nil) +# ) +# :4:4–9: error: ‘break’ outside ‘for’ +# break +# ^^^^^ + diff --git a/test-files/mds-kbdc/validate-tree/invalid/misplaced_assumption b/test-files/mds-kbdc/validate-tree/invalid/misplaced_assumption new file mode 100644 index 0000000..904ffd5 --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/invalid/misplaced_assumption @@ -0,0 +1,46 @@ +have +have_chars " " +have_range "a" "z" +information + have + have_chars " " + have_range "a" "z" +end information + +# (have (@ 1 0-4) +# (.data +# (keys (@ 1 5-12) ‘’) +# ) +# ) +# (have_chars (@ 2 0-10) ‘" "’) +# (have_range (@ 3 0-10) ‘"a"’ ‘"z"’) +# (information (@ 4 0-11) +# (.inner +# (have (@ 5 2-6) +# (.data +# (keys (@ 5 7-14) ‘’) +# ) +# ) +# (have_chars (@ 6 2-12) ‘" "’) +# (have_range (@ 7 2-12) ‘"a"’ ‘"z"’) +# ) +# ) +# :1:0–4: error: assumption outside assumption clause +# have +# ^^^^ +# :2:0–10: error: assumption outside assumption clause +# have_chars " " +# ^^^^^^^^^^ +# :3:0–10: error: assumption outside assumption clause +# have_range "a" "z" +# ^^^^^^^^^^ +# :5:2–6: error: assumption outside assumption clause +# have +# ^^^^ +# :6:2–12: error: assumption outside assumption clause +# have_chars " " +# ^^^^^^^^^^ +# :7:2–12: error: assumption outside assumption clause +# have_range "a" "z" +# ^^^^^^^^^^ + diff --git a/test-files/mds-kbdc/validate-tree/invalid/misplaced_information b/test-files/mds-kbdc/validate-tree/invalid/misplaced_information new file mode 100644 index 0000000..248a212 --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/invalid/misplaced_information @@ -0,0 +1,38 @@ +language "" +country "" +variant "" +assumption + language "" + country "" + variant "" +end assumption + +# (language (@ 1 0-8) ‘""’) +# (country (@ 2 0-7) ‘""’) +# (variant (@ 3 0-7) ‘""’) +# (assumption (@ 4 0-10) +# (.inner +# (language (@ 5 2-10) ‘""’) +# (country (@ 6 2-9) ‘""’) +# (variant (@ 7 2-9) ‘""’) +# ) +# ) +# :1:0–8: error: information outside information clause +# language "" +# ^^^^^^^^ +# :2:0–7: error: information outside information clause +# country "" +# ^^^^^^^ +# :3:0–7: error: information outside information clause +# variant "" +# ^^^^^^^ +# :5:2–10: error: information outside information clause +# language "" +# ^^^^^^^^ +# :6:2–9: error: information outside information clause +# country "" +# ^^^^^^^ +# :7:2–9: error: information outside information clause +# variant "" +# ^^^^^^^ + diff --git a/test-files/mds-kbdc/validate-tree/invalid/runaway_break b/test-files/mds-kbdc/validate-tree/invalid/runaway_break new file mode 100644 index 0000000..0e9911d --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/invalid/runaway_break @@ -0,0 +1,7 @@ +break + +# (break (@ 1 0-5)) +# :1:0–5: error: ‘break’ outside ‘for’ +# break +# ^^^^^ + diff --git a/test-files/mds-kbdc/validate-tree/invalid/runaway_continue b/test-files/mds-kbdc/validate-tree/invalid/runaway_continue new file mode 100644 index 0000000..a68b7e4 --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/invalid/runaway_continue @@ -0,0 +1,7 @@ +continue + +# (continue (@ 1 0-8)) +# :1:0–8: error: ‘continue’ outside ‘for’ +# continue +# ^^^^^^^^ + diff --git a/test-files/mds-kbdc/validate-tree/valid/assumption b/test-files/mds-kbdc/validate-tree/valid/assumption new file mode 100644 index 0000000..b8db1af --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/valid/assumption @@ -0,0 +1,18 @@ +assumption + have + have_chars " " + have_range "a" "z" +end assumption + +# (assumption (@ 1 0-10) +# (.inner +# (have (@ 2 2-6) +# (.data +# (keys (@ 2 7-14) ‘’) +# ) +# ) +# (have_chars (@ 3 2-12) ‘" "’) +# (have_range (@ 4 2-12) ‘"a"’ ‘"z"’) +# ) +# ) + diff --git a/test-files/mds-kbdc/validate-tree/valid/for-break b/test-files/mds-kbdc/validate-tree/valid/for-break new file mode 100644 index 0000000..2d726c3 --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/valid/for-break @@ -0,0 +1,10 @@ +for 1 to 9 as \1 + break +end for + +# (for (@ 1 0-3) ‘1’ ‘9’ (.variable ‘\1’) +# (.inner +# (break (@ 2 2-7)) +# ) +# ) + diff --git a/test-files/mds-kbdc/validate-tree/valid/for-continue b/test-files/mds-kbdc/validate-tree/valid/for-continue new file mode 100644 index 0000000..a8424b8 --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/valid/for-continue @@ -0,0 +1,10 @@ +for 1 to 9 as \1 + continue +end for + +# (for (@ 1 0-3) ‘1’ ‘9’ (.variable ‘\1’) +# (.inner +# (continue (@ 2 2-10)) +# ) +# ) + diff --git a/test-files/mds-kbdc/validate-tree/valid/for-for-end-break b/test-files/mds-kbdc/validate-tree/valid/for-for-end-break new file mode 100644 index 0000000..f910969 --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/valid/for-for-end-break @@ -0,0 +1,15 @@ +for 1 to 9 as \1 + for 1 to 9 as \2 + end for + break +end for + +# (for (@ 1 0-3) ‘1’ ‘9’ (.variable ‘\1’) +# (.inner +# (for (@ 2 2-5) ‘1’ ‘9’ (.variable ‘\2’) +# (.inner nil) +# ) +# (break (@ 4 2-7)) +# ) +# ) + diff --git a/test-files/mds-kbdc/validate-tree/valid/function-return b/test-files/mds-kbdc/validate-tree/valid/function-return new file mode 100644 index 0000000..a534c37 --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/valid/function-return @@ -0,0 +1,10 @@ +function f/0 + return +end function + +# (function (@ 1 0-8) ‘f/0’ +# (.inner +# (return (@ 2 2-8)) +# ) +# ) + diff --git a/test-files/mds-kbdc/validate-tree/valid/information b/test-files/mds-kbdc/validate-tree/valid/information new file mode 100644 index 0000000..9e2beac --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/valid/information @@ -0,0 +1,14 @@ +information + language "" + country "" + variant "" +end information + +# (information (@ 1 0-11) +# (.inner +# (language (@ 2 2-10) ‘""’) +# (country (@ 3 2-9) ‘""’) +# (variant (@ 4 2-9) ‘""’) +# ) +# ) + diff --git a/test-files/mds-kbdc/validate-tree/valid/macro-return b/test-files/mds-kbdc/validate-tree/valid/macro-return new file mode 100644 index 0000000..e29786d --- /dev/null +++ b/test-files/mds-kbdc/validate-tree/valid/macro-return @@ -0,0 +1,10 @@ +macro m/0 + return +end macro + +# (macro (@ 1 0-5) ‘m/0’ +# (.inner +# (return (@ 2 2-8)) +# ) +# ) + -- cgit v1.2.3-70-g09d2