Skip to content

Loading…

Optional argument in between regular arguments does not get reproduced #31

Closed
Gibheer opened this Issue · 2 comments

2 participants

@Gibheer

When having a function with an optional argument in the list of arguments the order gets destroyed.

def foo(bar1, bar2 = false, bar3)
end

gets converted to

def foo(bar1, bar3)
end

An example can be found here: https://github.com/libzero/zero/blob/master/lib/zero/renderer.rb#L41

git clone github.com/libzero/zero.git
bundle install
mutant -I lib --rspec-dm2 -r zero "::Zero::Renderer#initialize"
@mbj
Owner

This is a so called "noop fail". Prior to mutations on a subject mutant injects unmodified code (or at least what it thinks is unmodified code) to test the AST to source converter. This is basically a bug on to_source.

ToSource.to_source('def foo(bar, baz=:fuu, other; end'.to_ast) => "def foo(bar, other)"
@mbj
Owner

This is fixed with the upcoming release. See mbj/unparser@13168f5

@mbj mbj closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.