Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from phel-lang/improved-repl-line-numbers
Improved REPL line numbers and tested for CTRL-D and error messages
- Loading branch information
Showing
10 changed files
with
107 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/php/Integration/Repl/Fixtures/exit-multiline-mode-with-ctrl-d.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
phel:1> (php/+ 1 | ||
....:2> 2 | ||
....:3> <CTRL-D> | ||
phel:4> (php/+ 1 2) | ||
3 |
4 changes: 2 additions & 2 deletions
4
tests/php/Integration/Repl/Fixtures/simple-add-multiline.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
phel:1> (php/+ 1 | ||
....:1> 2 | ||
....:1> ) | ||
....:2> 2 | ||
....:3> ) | ||
3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
phel:1> (def my-fn (fn [] | ||
....:2> (undefined-fn 1 2))) | ||
Can not resolve symbol 'undefined-fn' | ||
in string:2 | ||
|
||
1| (def my-fn (fn [] | ||
2| (undefined-fn 1 2))) | ||
^^^^^^^^^^^^ | ||
|
14 changes: 14 additions & 0 deletions
14
tests/php/Integration/Repl/Fixtures/unterminated-list-multiline-with-empty-lines.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
phel:1> (php/+ 1 | ||
....:2> | ||
....:3> 2 | ||
....:4> | ||
....:5> ] | ||
Unterminated list (BRACKETS) | ||
in string:5 | ||
|
||
1| (php/+ 1 | ||
2| | ||
3| 2 | ||
4| | ||
5| ] | ||
^ |
11 changes: 5 additions & 6 deletions
11
tests/php/Integration/Repl/Fixtures/unterminated-list-multiline.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
phel:1> (php/+ 1 | ||
....:1> 2 | ||
....:1> ] | ||
....:2> 2 | ||
....:3> ] | ||
Unterminated list (BRACKETS) | ||
in string:3 | ||
|
||
3| (php/+ 1 | ||
4| 2 | ||
5| ] | ||
1| (php/+ 1 | ||
2| 2 | ||
3| ] | ||
^ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhelTest\Integration\Repl; | ||
|
||
final class InputLine | ||
{ | ||
private string $prompt; | ||
private string $content; | ||
|
||
public function __construct(string $prompt, string $content) | ||
{ | ||
$this->prompt = $prompt; | ||
$this->content = $content; | ||
} | ||
|
||
public function getContent(): string | ||
{ | ||
return $this->content; | ||
} | ||
|
||
public function isCtrlD(): bool | ||
{ | ||
return $this->content === '<CTRL-D>'; | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return $this->prompt . $this->content; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters