diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-02-16 23:45:45 +0100 |
|---|---|---|
| committer | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-02-16 23:45:45 +0100 |
| commit | 742c16dccef17a57494fe5846818cfc3324bbd45 (patch) | |
| tree | 7a8286e1935a77c16b958a6cb8b6e34071497270 /src/lib.rs | |
| parent | a668f98f725f27a9e9cdc40b75cc0f99b8f998a6 (diff) | |
| download | sylt-742c16dccef17a57494fe5846818cfc3324bbd45.tar.gz | |
add tests for unusued variables
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -856,6 +856,20 @@ mod tests { assert_errs!(run_string("a :: B()\n", true, Vec::new()), [ErrorKind::SyntaxError(_, _)]); } + #[test] + fn unused_variable() { + assert_errs!(run_string("a := 1", true, Vec::new()), [ErrorKind::SyntaxError(1, _)]); + } + + #[test] + fn unused_upvalue() { + assert_errs!(run_string("a := 1\nf :: fn { a = 2 }\nf()", true, Vec::new()), [ErrorKind::SyntaxError(1, _)]); + } + + #[test] + fn unused_function() { + assert_errs!(run_string("a := 1\nf := fn { a }\n", true, Vec::new()), [ErrorKind::SyntaxError(2, _)]); + } macro_rules! test_multiple { ($mod:ident, $( $fn:ident : $prog:literal ),+ $( , )? ) => { |
