Skip to content

Commit dad3f60

Browse files
committed
Reliably process chunks with control codes AND data
1 parent e530c42 commit dad3f60

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"react/event-loop": "0.3.*|0.4.*",
1616
"react/stream": "^0.4.2",
1717
"clue/utf8-react": "^0.1",
18-
"clue/term-react": "^0.1"
18+
"clue/term-react": "^0.1.1"
1919
},
2020
"autoload": {
2121
"psr-4": { "Clue\\React\\Stdio\\": "src/" }

tests/ReadlineTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,22 @@ public function testDataEventWillBeEmittedForCompleteLine()
198198
$this->input->emit('data', array("hello\n"));
199199
}
200200

201-
public function testDataEventWillNotBeEmittedForIncompleteLine()
201+
public function testDataEventWillNotBeEmittedForIncompleteLineButWillStayInInputBuffer()
202202
{
203203
$this->readline->on('data', $this->expectCallableNever());
204204

205205
$this->input->emit('data', array("hello"));
206+
207+
$this->assertEquals('hello', $this->readline->getInput());
208+
}
209+
210+
public function testDataEventWillBeEmittedForCompleteLineAndRemainingWillStayInInputBuffer()
211+
{
212+
$this->readline->on('data', $this->expectCallableOnceWith('hello'));
213+
214+
$this->input->emit('data', array("hello\nworld"));
215+
216+
$this->assertEquals('world', $this->readline->getInput());
206217
}
207218

208219
public function testDataEventWillBeEmittedForEmptyLine()

0 commit comments

Comments
 (0)