mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-02 07:53:43 +08:00
eaecb817ca
This makes two changes: 1. Remove the 'brace_text_start' idea. The idea of 'brace_text_start' was to prevent emitting `BRACE_SPACE` at the beginning or end of an item. But we later strip these off anyways, so there is no apparent benefit. If we are not doing brace expansion, this prevented emitting whitespace at the beginning or end of an item, leading to #6564. 2. When performing brace expansion, only stomp the space character with `BRACE_SPACE`; do not stomp newlines and tabs. This is because the fix in came from a newline or tab literal, then we would have effectively replaced a newline or tab with a space, so this is important for #6564 as well. Moreover, it is not easy to place a literal newline or tab inside a brace expansion, and users who do probably do not mean for it to be stripped, so I believe this is a good change in general. Fixes #6564
132 lines
2.5 KiB
Plaintext
132 lines
2.5 KiB
Plaintext
|
|
####################
|
|
# Comments in odd places don't cause problems
|
|
1a
|
|
1b
|
|
2a
|
|
2b
|
|
|
|
####################
|
|
# Escaped newlines
|
|
foo bar
|
|
foobar
|
|
foobar
|
|
foo\
|
|
bar
|
|
a
|
|
b
|
|
c
|
|
|
|
####################
|
|
# Simple function tests
|
|
Test 2 pass
|
|
Test 3a pass
|
|
Test 3b pass
|
|
Test 4 pass
|
|
|
|
####################
|
|
# Testing builtin status
|
|
Test 5 pass
|
|
|
|
####################
|
|
# Verify that we can turn stderr into stdout and then pipe it
|
|
errput
|
|
output
|
|
errput
|
|
output
|
|
|
|
####################
|
|
# Test that trailing ^ doesn't trigger redirection, see #1873
|
|
caret_no_redirect 12345^
|
|
|
|
####################
|
|
# Verify that we can pipe something other than stdout
|
|
is_stdout
|
|
|
|
####################
|
|
# echo tests
|
|
abc\ndef
|
|
abc
|
|
def
|
|
abc\zdef
|
|
abc!def
|
|
abc!def
|
|
abcQdef
|
|
abcQ2def
|
|
abc
|
|
-
|
|
-h
|
|
0000000 376
|
|
0000001
|
|
Catch your breath
|
|
abc!def
|
|
abc!1def
|
|
|
|
####################
|
|
# Verify that pipes don't conflict with fd redirections
|
|
pipe 3
|
|
pipe 4
|
|
pipe 5
|
|
pipe 6
|
|
pipe 7
|
|
pipe 8
|
|
pipe 9
|
|
pipe 10
|
|
pipe 11
|
|
pipe 12
|
|
|
|
####################
|
|
# Make sure while loops don't run forever with no-exec (#1543)
|
|
Checking for infinite loops in no-execute
|
|
|
|
####################
|
|
# For loops with read-only vars is an error (#4342)
|
|
|
|
####################
|
|
# That goes for non-electric ones as well (#5548)
|
|
|
|
####################
|
|
# For loop control vars available outside the for block
|
|
$loop_var: set in local scope, unexported, with 1 elements
|
|
$loop_var[1]: length=1 value=|c|
|
|
$loop_var: not set in global scope
|
|
$loop_var: not set in universal scope
|
|
|
|
$loop_var: set in local scope, unexported, with 1 elements
|
|
$loop_var[1]: length=1 value=|b|
|
|
$loop_var: set in global scope, unexported, with 1 elements
|
|
$loop_var[1]: length=10 value=|global_val|
|
|
$loop_var: not set in universal scope
|
|
|
|
$loop_var: not set in local scope
|
|
$loop_var: set in global scope, unexported, with 1 elements
|
|
$loop_var[1]: length=10 value=|global_val|
|
|
$loop_var: not set in universal scope
|
|
|
|
$loop_var: set in local scope, unexported, with 1 elements
|
|
$loop_var[1]: length=2 value=|cc|
|
|
$loop_var: set in global scope, unexported, with 1 elements
|
|
$loop_var[1]: length=10 value=|global_val|
|
|
$loop_var: not set in universal scope
|
|
|
|
$loop_var: not set in local scope
|
|
$loop_var: set in global scope, unexported, with 1 elements
|
|
$loop_var[1]: length=10 value=|global_val|
|
|
$loop_var: not set in universal scope
|
|
|
|
|
|
####################
|
|
# Comments allowed in between lines (#1987)
|
|
before comment after comment
|
|
|
|
####################
|
|
# Backslashes are part of comments and do not join lines (#1255)
|
|
|
|
####################
|
|
# Verify $argv set correctly in sourced scripts (#139)
|
|
source argv {}
|
|
source argv {}
|
|
source argv {abc}
|
|
source argv {abc def}
|
|
1
|