From cb09d47dc8a3a098d23aff126b022b7f40c6292a Mon Sep 17 00:00:00 2001 From: rexim Date: Tue, 28 May 2024 10:49:14 +0700 Subject: [PATCH] Add tests for unused variables --- tests.list | 3 ++- tests/unused-vars.tula | 5 +++++ tests/unused-vars.tula.expect | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/unused-vars.tula create mode 100644 tests/unused-vars.tula.expect diff --git a/tests.list b/tests.list index 874f660..2f0f197 100644 --- a/tests.list +++ b/tests.list @@ -17,4 +17,5 @@ ./tests/real.tula,run ./tests/string.tula,run ./tests/left-tape.tula,run -./tests/double-subst.tula,ignore \ No newline at end of file +./tests/double-subst.tula,ignore +./tests/unused-vars.tula,run diff --git a/tests/unused-vars.tula b/tests/unused-vars.tula new file mode 100644 index 0000000..9cc0b10 --- /dev/null +++ b/tests/unused-vars.tula @@ -0,0 +1,5 @@ +trace . { . } + +for a b in { 1 2 3 } { + case . . . . . +} diff --git a/tests/unused-vars.tula.expect b/tests/unused-vars.tula.expect new file mode 100644 index 0000000..d4dbb7b --- /dev/null +++ b/tests/unused-vars.tula.expect @@ -0,0 +1,3 @@ +./tests/unused-vars.tula:4:5: ERROR: not all variables in the scope are used in the input of the case +./tests/unused-vars.tula:3:5: NOTE: unused variable a +./tests/unused-vars.tula:3:7: NOTE: unused variable b