an instance of
local buffer, input
before_each ->
buffer = Buffer!
buffer.text = 'one\ntwo'
editor = Editor buffer
input = inputs.line 'line', editor
.should_complete() returns true
assert.is_true input\should_complete!
.complete(text)
returns the nr and lines available in the buffer as completions
completions = input\complete ''
assert.equal 2, #completions
assert.same { '1', 'one' }, { completions[1][1], tostring completions[1][2] }
.value_for(text)
(with no prior readline interaction)
returns the specified line and the column position 1
assert.same { buffer.lines[1], 1 }, { input\value_for '1' }
(with a prior submit)
returns the relevant line and the matching column
readline = text: 'ne'
input\on_selection_changed { 1, buffer.lines[1] }, readline
assert.same { buffer.lines[1], 2 }, { input\value_for '1' }