@@ -530,14 +530,14 @@ public function testAutocompleteWillNotBeCalledAfterUnset()
530530
531531 public function testAutocompleteWillBeCalledWithEmptyBuffer ()
532532 {
533- $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('' , 0 ));
533+ $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('' , 0 , 0 ));
534534
535535 $ this ->readline ->onKeyTab ();
536536 }
537537
538538 public function testAutocompleteWillBeCalledWithCompleteWord ()
539539 {
540- $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('hello ' , 0 ));
540+ $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('hello ' , 0 , 5 ));
541541
542542 $ this ->readline ->setInput ('hello ' );
543543
@@ -546,7 +546,7 @@ public function testAutocompleteWillBeCalledWithCompleteWord()
546546
547547 public function testAutocompleteWillBeCalledWithWordPrefix ()
548548 {
549- $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('he ' , 0 ));
549+ $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('he ' , 0 , 2 ));
550550
551551 $ this ->readline ->setInput ('hello ' );
552552 $ this ->readline ->moveCursorTo (2 );
@@ -556,7 +556,7 @@ public function testAutocompleteWillBeCalledWithWordPrefix()
556556
557557 public function testAutocompleteWillBeCalledWithLastWord ()
558558 {
559- $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('world ' , 6 ));
559+ $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('world ' , 6 , 11 ));
560560
561561 $ this ->readline ->setInput ('hello world ' );
562562
@@ -565,14 +565,34 @@ public function testAutocompleteWillBeCalledWithLastWord()
565565
566566 public function testAutocompleteWillBeCalledWithLastWordPrefix ()
567567 {
568- $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('wo ' , 6 ));
568+ $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('wo ' , 6 , 8 ));
569569
570570 $ this ->readline ->setInput ('hello world ' );
571571 $ this ->readline ->moveCursorTo (8 );
572572
573573 $ this ->readline ->onKeyTab ();
574574 }
575575
576+ public function testAutocompleteWillBeCalledWithLastWordPrefixUnicode ()
577+ {
578+ $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('wö ' , 6 , 8 ));
579+
580+ $ this ->readline ->setInput ('hällö wörld ' );
581+ $ this ->readline ->moveCursorTo (8 );
582+
583+ $ this ->readline ->onKeyTab ();
584+ }
585+
586+ public function testAutocompleteWillBeCalledWithLastWordPrefixQuotedUnicode ()
587+ {
588+ $ this ->readline ->setAutocomplete ($ this ->expectCallableOnceWith ('wö ' , 9 , 11 ));
589+
590+ $ this ->readline ->setInput ('"hällö" "wörld" ' );
591+ $ this ->readline ->moveCursorTo (11 );
592+
593+ $ this ->readline ->onKeyTab ();
594+ }
595+
576596 public function testAutocompleteAddsSpaceAfterComplete ()
577597 {
578598 $ this ->readline ->setAutocomplete (function () { return array ('exit ' ); });
0 commit comments