-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added support for elevated shells starting commands with `#` instead of `$`. - The user and cwd info `bash` and `sh` print before the interactive shell will now be highlighted. - Changed the line ends of test files to CRLF.
- Loading branch information
1 parent
15983d5
commit bd16bd5
Showing
6 changed files
with
207 additions
and
106 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,44 @@ | ||
$ git checkout master | ||
Switched to branch 'master' | ||
Your branch is up-to-date with 'origin/master'. | ||
$ git push | ||
Everything up-to-date | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["function", "git"], | ||
" checkout master" | ||
]] | ||
]], | ||
["output", "Switched to branch 'master'\nYour branch is up-to-date with 'origin/master'.\n"], | ||
|
||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["function", "git"], | ||
" push" | ||
]] | ||
]], | ||
["output", "Everything up-to-date"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for commands. | ||
$ git checkout master | ||
Switched to branch 'master' | ||
Your branch is up-to-date with 'origin/master'. | ||
$ git push | ||
Everything up-to-date | ||
# echo "root" | ||
root | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["command", [ | ||
["shell-symbol", "$"], | ||
["bash", [ | ||
["function", "git"], | ||
" checkout master" | ||
]] | ||
]], | ||
["output", "Switched to branch 'master'\r\nYour branch is up-to-date with 'origin/master'.\r\n"], | ||
|
||
["command", [ | ||
["shell-symbol", "$"], | ||
["bash", [ | ||
["function", "git"], | ||
" push" | ||
]] | ||
]], | ||
["output", "Everything up-to-date\r\n"], | ||
|
||
["command", [ | ||
["shell-symbol", "#"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["string", [ | ||
"\"root\"" | ||
]] | ||
]] | ||
]], | ||
["output", "root"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for commands. |
132 changes: 66 additions & 66 deletions
132
tests/languages/shell-session/command_string_feature.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,66 +1,66 @@ | ||
$ echo 'Foo | ||
> Bar' | ||
$ echo "Foo | ||
> Bar" | ||
|
||
$ echo <<- STRING_END | ||
foo | ||
bar | ||
STRING_END | ||
|
||
$ echo <<- "STRING_END" | ||
foo | ||
bar | ||
STRING_END | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["string", [ | ||
"'Foo\n> Bar'" | ||
]] | ||
]] | ||
]], | ||
|
||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["string", [ | ||
"\"Foo\n> Bar\"" | ||
]] | ||
]] | ||
]], | ||
|
||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["operator", [ | ||
"<<-" | ||
]], | ||
["string", [ | ||
"STRING_END\nfoo\nbar\nSTRING_END" | ||
]] | ||
]] | ||
]], | ||
|
||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["operator", [ | ||
"<<-" | ||
]], | ||
["string", "\"STRING_END\"\nfoo\nbar\nSTRING_END"] | ||
]] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for multi-line strings inside commands. | ||
$ echo 'Foo | ||
> Bar' | ||
$ echo "Foo | ||
> Bar" | ||
$ echo <<- STRING_END | ||
foo | ||
bar | ||
STRING_END | ||
$ echo <<- "STRING_END" | ||
foo | ||
bar | ||
STRING_END | ||
---------------------------------------------------- | ||
[ | ||
["command", [ | ||
["shell-symbol", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["string", [ | ||
"'Foo\r\n> Bar'" | ||
]] | ||
]] | ||
]], | ||
["command", [ | ||
["shell-symbol", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["string", [ | ||
"\"Foo\r\n> Bar\"" | ||
]] | ||
]] | ||
]], | ||
["command", [ | ||
["shell-symbol", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["operator", [ | ||
"<<-" | ||
]], | ||
["string", [ | ||
"STRING_END\r\nfoo\r\nbar\r\nSTRING_END" | ||
]] | ||
]] | ||
]], | ||
["command", [ | ||
["shell-symbol", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["operator", [ | ||
"<<-" | ||
]], | ||
["string", "\"STRING_END\"\r\nfoo\r\nbar\r\nSTRING_END"] | ||
]] | ||
]] | ||
] | ||
---------------------------------------------------- | ||
Checks for multi-line strings inside commands. |
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,68 @@ | ||
foo@bar:/var/local$ cd ~ | ||
foo@bar:~$ sudo -i | ||
[sudo] password for foo: | ||
root@bar:~# echo "hello!" | ||
hello! | ||
|
||
foo@bar$ exit | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["info", [ | ||
["user", "foo@bar"], | ||
["punctuation", ":"], | ||
["path", "/var/local"] | ||
]], | ||
["command", [ | ||
["shell-symbol", "$"], | ||
["bash", [ | ||
["builtin", "cd"], | ||
" ~" | ||
]] | ||
]], | ||
|
||
["info", [ | ||
["user", "foo@bar"], | ||
["punctuation", ":"], | ||
["path", "~"] | ||
]], | ||
["command", [ | ||
["shell-symbol", "$"], | ||
["bash", [ | ||
["function", "sudo"], | ||
" -i" | ||
]] | ||
]], | ||
["output", "[sudo] password for foo:\r\n"], | ||
|
||
["info", [ | ||
["user", "root@bar"], | ||
["punctuation", ":"], | ||
["path", "~"] | ||
]], | ||
["command", [ | ||
["shell-symbol", "#"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["string", [ | ||
"\"hello!\"" | ||
]] | ||
]] | ||
]], | ||
["output", "hello!\r\n\r\n"], | ||
|
||
["info", [ | ||
["user", "foo@bar"] | ||
]], | ||
["command", [ | ||
["shell-symbol", "$"], | ||
["bash", [ | ||
["builtin", "exit"] | ||
]] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for the info bash outputs. |