From 437ee31fac70799f9fafc7864655283270d4fed8 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 9 Dec 2014 17:02:21 +0100 Subject: mds-kbdc: m bug fixes + more test cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .../compile-layout/invalid/macro-value_without_sideeffect | 5 +++++ .../mds-kbdc/compile-layout/invalid/nilreturning_function | 4 ++++ .../mds-kbdc/compile-layout/invalid/value_without_sideeffect | 2 ++ .../compile-layout/valid/do_not_shadow_variable_with_for | 5 +++++ .../mds-kbdc/compile-layout/valid/function-if-value-end-value | 10 ++++++++++ .../mds-kbdc/compile-layout/valid/function-value-if-value | 8 ++++++++ .../compile-layout/valid/function-value-if-value-end-value | 11 +++++++++++ test-files/mds-kbdc/compile-layout/valid/function-value-value | 6 ++++++ test-files/mds-kbdc/compile-layout/valid/identity_function | 5 +++++ .../compile-layout/valid/let-function-end-nonshadowing_for | 7 +++++++ .../mds-kbdc/compile-layout/valid/let-function-shadowing_for | 7 +++++++ test-files/mds-kbdc/compile-layout/valid/macro_1 | 5 +++++ .../mds-kbdc/compile-layout/valid/map_with_function_call | 5 +++++ test-files/mds-kbdc/compile-layout/valid/override_variable | 3 +++ .../mds-kbdc/compile-layout/valid/shadow_variable_with_for | 7 +++++++ .../compile-layout/valid/shadow_variable_with_function_call | 7 +++++++ .../mds-kbdc/compile-layout/valid/shadow_variable_with_let | 9 +++++++++ .../compile-layout/valid/shadow_variable_with_macro_call | 6 ++++++ .../compile-layout/valid/value_with_indirect_sideeffect | 6 ++++++ .../mds-kbdc/compile-layout/valid/value_with_sideeffect | 3 +++ 20 files changed, 121 insertions(+) create mode 100644 test-files/mds-kbdc/compile-layout/invalid/macro-value_without_sideeffect create mode 100644 test-files/mds-kbdc/compile-layout/invalid/nilreturning_function create mode 100644 test-files/mds-kbdc/compile-layout/invalid/value_without_sideeffect create mode 100644 test-files/mds-kbdc/compile-layout/valid/do_not_shadow_variable_with_for create mode 100644 test-files/mds-kbdc/compile-layout/valid/function-if-value-end-value create mode 100644 test-files/mds-kbdc/compile-layout/valid/function-value-if-value create mode 100644 test-files/mds-kbdc/compile-layout/valid/function-value-if-value-end-value create mode 100644 test-files/mds-kbdc/compile-layout/valid/function-value-value create mode 100644 test-files/mds-kbdc/compile-layout/valid/identity_function create mode 100644 test-files/mds-kbdc/compile-layout/valid/let-function-end-nonshadowing_for create mode 100644 test-files/mds-kbdc/compile-layout/valid/let-function-shadowing_for create mode 100644 test-files/mds-kbdc/compile-layout/valid/macro_1 create mode 100644 test-files/mds-kbdc/compile-layout/valid/map_with_function_call create mode 100644 test-files/mds-kbdc/compile-layout/valid/override_variable create mode 100644 test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_for create mode 100644 test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_function_call create mode 100644 test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_let create mode 100644 test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_macro_call create mode 100644 test-files/mds-kbdc/compile-layout/valid/value_with_indirect_sideeffect create mode 100644 test-files/mds-kbdc/compile-layout/valid/value_with_sideeffect (limited to 'test-files/mds-kbdc/compile-layout') diff --git a/test-files/mds-kbdc/compile-layout/invalid/macro-value_without_sideeffect b/test-files/mds-kbdc/compile-layout/invalid/macro-value_without_sideeffect new file mode 100644 index 0000000..a85e1b2 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/invalid/macro-value_without_sideeffect @@ -0,0 +1,5 @@ +macro m/0 + "a" +end macro +m() + diff --git a/test-files/mds-kbdc/compile-layout/invalid/nilreturning_function b/test-files/mds-kbdc/compile-layout/invalid/nilreturning_function new file mode 100644 index 0000000..f3518a4 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/invalid/nilreturning_function @@ -0,0 +1,4 @@ +function f/0 +end function +"\f()" : "" + diff --git a/test-files/mds-kbdc/compile-layout/invalid/value_without_sideeffect b/test-files/mds-kbdc/compile-layout/invalid/value_without_sideeffect new file mode 100644 index 0000000..8da2ae3 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/invalid/value_without_sideeffect @@ -0,0 +1,2 @@ +"a" + diff --git a/test-files/mds-kbdc/compile-layout/valid/do_not_shadow_variable_with_for b/test-files/mds-kbdc/compile-layout/valid/do_not_shadow_variable_with_for new file mode 100644 index 0000000..677735c --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/do_not_shadow_variable_with_for @@ -0,0 +1,5 @@ +let \1 : 0 +for 1 to 1 as \1 +end for +\1 : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/function-if-value-end-value b/test-files/mds-kbdc/compile-layout/valid/function-if-value-end-value new file mode 100644 index 0000000..0b90798 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/function-if-value-end-value @@ -0,0 +1,10 @@ +# It is acceptable not to find unneccessary statements + +function f/0 + if 1 + "a" + end if + "a" +end function + : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/function-value-if-value b/test-files/mds-kbdc/compile-layout/valid/function-value-if-value new file mode 100644 index 0000000..a9f2394 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/function-value-if-value @@ -0,0 +1,8 @@ +function f/0 + "a" + if 1 + "a" + end if +end function + : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/function-value-if-value-end-value b/test-files/mds-kbdc/compile-layout/valid/function-value-if-value-end-value new file mode 100644 index 0000000..3d8644a --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/function-value-if-value-end-value @@ -0,0 +1,11 @@ +# It is acceptable not to find unneccessary statements + +function f/0 + "a" + if 1 + "a" + end if + "a" +end function + : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/function-value-value b/test-files/mds-kbdc/compile-layout/valid/function-value-value new file mode 100644 index 0000000..71a282e --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/function-value-value @@ -0,0 +1,6 @@ +function f/0 + "a" + "a" +end function + : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/identity_function b/test-files/mds-kbdc/compile-layout/valid/identity_function new file mode 100644 index 0000000..0cd4371 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/identity_function @@ -0,0 +1,5 @@ +function id/1 + \1 +end function + : "\id("a")" + diff --git a/test-files/mds-kbdc/compile-layout/valid/let-function-end-nonshadowing_for b/test-files/mds-kbdc/compile-layout/valid/let-function-end-nonshadowing_for new file mode 100644 index 0000000..8bae30b --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/let-function-end-nonshadowing_for @@ -0,0 +1,7 @@ +let \1 : 0 +function f/0 +end function +for "a" to "a" as \1 +end for +\1 : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/let-function-shadowing_for b/test-files/mds-kbdc/compile-layout/valid/let-function-shadowing_for new file mode 100644 index 0000000..1086217 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/let-function-shadowing_for @@ -0,0 +1,7 @@ +let \1 : "" +function f/0 + for 0 to 0 as \1 + end for +end function +\1 : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/macro_1 b/test-files/mds-kbdc/compile-layout/valid/macro_1 new file mode 100644 index 0000000..3d7323d --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/macro_1 @@ -0,0 +1,5 @@ +macro m/1 + : \1 +end macro +m("a") + diff --git a/test-files/mds-kbdc/compile-layout/valid/map_with_function_call b/test-files/mds-kbdc/compile-layout/valid/map_with_function_call new file mode 100644 index 0000000..f85ef2b --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/map_with_function_call @@ -0,0 +1,5 @@ +function f/0 + "a" +end function + : "\f()" + diff --git a/test-files/mds-kbdc/compile-layout/valid/override_variable b/test-files/mds-kbdc/compile-layout/valid/override_variable new file mode 100644 index 0000000..30d0bdb --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/override_variable @@ -0,0 +1,3 @@ +let \4 : { 0 } +let \4 : { 0 0 } + diff --git a/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_for b/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_for new file mode 100644 index 0000000..37ea0c3 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_for @@ -0,0 +1,7 @@ +let \1 : "a" +function f/0 + for 0 to 0 as \1 + end for +end function +\1 : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_function_call b/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_function_call new file mode 100644 index 0000000..b858438 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_function_call @@ -0,0 +1,7 @@ +let \1 : "a" +function f/1 + "" +end function +"" : "\f(0)" +\1 : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_let b/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_let new file mode 100644 index 0000000..a19cc88 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_let @@ -0,0 +1,9 @@ +let \1 : "a" +function f/0 + let \1 : "b" +end function +if \equals(\1 "b") + let \1 : 0 +end if +\1 : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_macro_call b/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_macro_call new file mode 100644 index 0000000..6352d0d --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/shadow_variable_with_macro_call @@ -0,0 +1,6 @@ +let \1 : "a" +macro m/1 +end macro +m(0) +\1 : "" + diff --git a/test-files/mds-kbdc/compile-layout/valid/value_with_indirect_sideeffect b/test-files/mds-kbdc/compile-layout/valid/value_with_indirect_sideeffect new file mode 100644 index 0000000..24c9f5b --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/value_with_indirect_sideeffect @@ -0,0 +1,6 @@ +let \4 : { 0 } +function xset/3 + "\set(\1 \2 \3)" +end function +"\xset(4 0 0)" + diff --git a/test-files/mds-kbdc/compile-layout/valid/value_with_sideeffect b/test-files/mds-kbdc/compile-layout/valid/value_with_sideeffect new file mode 100644 index 0000000..2c0f982 --- /dev/null +++ b/test-files/mds-kbdc/compile-layout/valid/value_with_sideeffect @@ -0,0 +1,3 @@ +let \1 : { 0 } +"\set(1 0 0)" + -- cgit v1.2.3-70-g09d2