mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
use new logmsg
and set --show
in tests
This commit is contained in:
parent
864dbaeb43
commit
10fae1836e
3 changed files with 84 additions and 27 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Test the -V flag
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Testing -V
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Testing -V with changed variables
|
||||||
fish: function: Illegal function name '-a'
|
fish: function: Illegal function name '-a'
|
||||||
function -a arg1 arg2 name2 ; end
|
function -a arg1 arg2 name2 ; end
|
||||||
^
|
^
|
||||||
|
@ -7,3 +16,9 @@ function --argument-names arg1 arg2 name4 ; end
|
||||||
fish: function: Unexpected positional argument 'abc'
|
fish: function: Unexpected positional argument 'abc'
|
||||||
function name5 abc --argument-names def ; end
|
function name5 abc --argument-names def ; end
|
||||||
^
|
^
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Verify that functions can be copied. Tests against regression of issue #3601
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Checking that the copied functions are identical other than the name
|
||||||
|
|
|
@ -2,17 +2,19 @@
|
||||||
#
|
#
|
||||||
# Test the `function` builtin
|
# Test the `function` builtin
|
||||||
|
|
||||||
# Test the -V flag
|
logmsg Test the -V flag
|
||||||
set -g foo 'global foo'
|
set -g foo 'global foo'
|
||||||
set -l foo 'local foo'
|
set -l foo 'local foo'
|
||||||
set bar one 'two 2' \t '' 3
|
set bar one 'two 2' \t '' 3
|
||||||
set baz
|
set baz
|
||||||
function frob -V foo -V bar -V baz
|
function frob -V foo -V bar -V baz
|
||||||
show foo bar baz
|
set --show foo bar baz
|
||||||
end
|
end
|
||||||
echo "Testing -V"
|
|
||||||
|
logmsg Testing -V
|
||||||
frob
|
frob
|
||||||
echo "Testing -V with changed variables"
|
|
||||||
|
logmsg Testing -V with changed variables
|
||||||
set foo 'bad foo'
|
set foo 'bad foo'
|
||||||
set bar 'bad bar'
|
set bar 'bad bar'
|
||||||
set baz 'bad baz'
|
set baz 'bad baz'
|
||||||
|
@ -32,14 +34,15 @@ functions -q name2; or echo "Function name2 not found as expected"
|
||||||
functions -q name3; and echo "Function name3 found"
|
functions -q name3; and echo "Function name3 found"
|
||||||
functions -q name4; or echo "Function name4 not found as expected"
|
functions -q name4; or echo "Function name4 not found as expected"
|
||||||
|
|
||||||
# Verify that functions can be copied. Tests against regression of issue #3601.
|
logmsg Verify that functions can be copied. Tests against regression of issue \#3601
|
||||||
functions -c name1 name1a
|
functions -c name1 name1a
|
||||||
functions --copy name3 name3a
|
functions --copy name3 name3a
|
||||||
functions -q name1a
|
functions -q name1a
|
||||||
or echo "Function name1a not found as expected"
|
or echo "Function name1a not found as expected"
|
||||||
functions -q name3a
|
functions -q name3a
|
||||||
or echo "Function name3a not found as expected"
|
or echo "Function name3a not found as expected"
|
||||||
echo Checking that the copied functions are identical other than the name
|
|
||||||
|
logmsg Checking that the copied functions are identical other than the name
|
||||||
diff (functions name1 | psub) (functions name1a | psub)
|
diff (functions name1 | psub) (functions name1a | psub)
|
||||||
diff (functions name3 | psub) (functions name3a | psub)
|
diff (functions name3 | psub) (functions name3a | psub)
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,67 @@
|
||||||
Testing -V
|
|
||||||
$foo count=1
|
####################
|
||||||
$foo[1]=|local foo|
|
# Test the -V flag
|
||||||
$bar count=5
|
|
||||||
$bar[1]=|one|
|
####################
|
||||||
$bar[2]=|two 2|
|
# Testing -V
|
||||||
$bar[3]=| |
|
$foo: set in local scope, unexported, with 1 elements
|
||||||
$bar[4]=||
|
$foo[0]: length=9 value=|local foo|
|
||||||
$bar[5]=|3|
|
$foo: set in global scope, unexported, with 1 elements
|
||||||
$baz count=0
|
$foo[0]: length=10 value=|global foo|
|
||||||
Testing -V with changed variables
|
$foo: not set in universal scope
|
||||||
$foo count=1
|
|
||||||
$foo[1]=|local foo|
|
$bar: set in local scope, unexported, with 5 elements
|
||||||
$bar count=5
|
$bar[0]: length=3 value=|one|
|
||||||
$bar[1]=|one|
|
$bar[1]: length=8 value=|two 2|
|
||||||
$bar[2]=|two 2|
|
$bar[2]: length=1 value=|\t|
|
||||||
$bar[3]=| |
|
$bar[3]: length=0 value=||
|
||||||
$bar[4]=||
|
$bar[4]: length=1 value=|3|
|
||||||
$bar[5]=|3|
|
$bar: set in global scope, unexported, with 5 elements
|
||||||
$baz count=0
|
$bar[0]: length=3 value=|one|
|
||||||
|
$bar[1]: length=8 value=|two 2|
|
||||||
|
$bar[2]: length=1 value=|\t|
|
||||||
|
$bar[3]: length=0 value=||
|
||||||
|
$bar[4]: length=1 value=|3|
|
||||||
|
$bar: not set in universal scope
|
||||||
|
|
||||||
|
$baz: set in local scope, unexported, with 0 elements
|
||||||
|
$baz: set in global scope, unexported, with 0 elements
|
||||||
|
$baz: not set in universal scope
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Testing -V with changed variables
|
||||||
|
$foo: set in local scope, unexported, with 1 elements
|
||||||
|
$foo[0]: length=9 value=|local foo|
|
||||||
|
$foo: set in global scope, unexported, with 1 elements
|
||||||
|
$foo[0]: length=10 value=|global foo|
|
||||||
|
$foo: not set in universal scope
|
||||||
|
|
||||||
|
$bar: set in local scope, unexported, with 5 elements
|
||||||
|
$bar[0]: length=3 value=|one|
|
||||||
|
$bar[1]: length=8 value=|two 2|
|
||||||
|
$bar[2]: length=1 value=|\t|
|
||||||
|
$bar[3]: length=0 value=||
|
||||||
|
$bar[4]: length=1 value=|3|
|
||||||
|
$bar: set in global scope, unexported, with 1 elements
|
||||||
|
$bar[0]: length=7 value=|bad bar|
|
||||||
|
$bar: not set in universal scope
|
||||||
|
|
||||||
|
$baz: set in local scope, unexported, with 0 elements
|
||||||
|
$baz: set in global scope, unexported, with 1 elements
|
||||||
|
$baz[0]: length=7 value=|bad baz|
|
||||||
|
$baz: not set in universal scope
|
||||||
|
|
||||||
Function name1 found
|
Function name1 found
|
||||||
Function name2 not found as expected
|
Function name2 not found as expected
|
||||||
Function name3 found
|
Function name3 found
|
||||||
Function name4 not found as expected
|
Function name4 not found as expected
|
||||||
Checking that the copied functions are identical other than the name
|
|
||||||
|
####################
|
||||||
|
# Verify that functions can be copied. Tests against regression of issue #3601
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Checking that the copied functions are identical other than the name
|
||||||
1c1
|
1c1
|
||||||
< function name1 --argument arg1 arg2
|
< function name1 --argument arg1 arg2
|
||||||
---
|
---
|
||||||
|
|
Loading…
Reference in a new issue