mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-03 11:51:15 -03:00
Properly print leading comments and indentation in functions
Store the entire function declaration, not just its job list. This allows us to extract the body of the function complete with any leading comments and indents. Fixes #5285
This commit is contained in:
35
tests/checks/function-definition.fish
Normal file
35
tests/checks/function-definition.fish
Normal file
@@ -0,0 +1,35 @@
|
||||
#RUN: %fish %s
|
||||
|
||||
function stuff --argument a b c
|
||||
# This is a comment
|
||||
echo stuff
|
||||
# This is another comment
|
||||
end
|
||||
|
||||
functions stuff
|
||||
#CHECK: # Defined in {{.*}}
|
||||
#CHECK: function stuff --argument a b c
|
||||
#CHECK: # This is a comment
|
||||
#CHECK: echo stuff
|
||||
#CHECK: # This is another comment
|
||||
#CHECK: end
|
||||
|
||||
function commenting
|
||||
|
||||
# line 2
|
||||
|
||||
# line 4
|
||||
|
||||
echo Bye bye says line 6
|
||||
end
|
||||
|
||||
functions commenting
|
||||
#CHECK: # Defined in {{.*}}
|
||||
#CHECK: function commenting
|
||||
#CHECK:
|
||||
#CHECK: # line 2
|
||||
#CHECK:
|
||||
#CHECK: # line 4
|
||||
#CHECK:
|
||||
#CHECK: echo Bye bye says line 6
|
||||
#CHECK: end
|
||||
Reference in New Issue
Block a user