Code-Inspect / flowr

A program slicer and dataflow analyzer for the R programming language.
https://github.com/Code-Inspect/flowr/wiki
GNU General Public License v3.0
14 stars 2 forks source link

Checking expected output for tests doesn't seem to cause the shell to be cleaned up #807

Closed Ellpeck closed 1 month ago

Ellpeck commented 1 month ago

Specifically, running a test like

        assertSliced(label('redefine if', ['name-escaped', ...OperatorDatabase['<-'].capabilities, 'numbers', 'formals-dot-dot-dot', 'newlines', 'unnamed-arguments']),
            shell, `\`if\` <- function(...) 2
if(1) 
   x <- 3
print(x)`, ['4@x'], 'x <- 3\nx', { expectedOutput: '[1] 2' })

causes future tests to fail, even tests without an expected output, indicating that it causes the shell to choke somehow.

EagleoutIce commented 1 month ago

This is solely related to the fact that the code does not have x in the given example and requires the previous x <- 1 definition, otherwise it is syntactically incorrect. Wen can do a separate issue (open it if you want to) which improves expectedOutputs error handling in general. I transform this issue to another one: the expected slice is wrong and should be x <- 1 (or whatever is defined before) as x <- 3 is not active.

EagleoutIce commented 1 month ago

Part of #98.