mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Switch variable name in tests from foo to something less likely to be
used accidentally
This commit is contained in:
parent
5cda1e55e0
commit
18c1b12741
1 changed files with 44 additions and 44 deletions
|
@ -113,23 +113,23 @@ end
|
||||||
|
|
||||||
# Test erasing variables in specific scope
|
# Test erasing variables in specific scope
|
||||||
|
|
||||||
set -eU foo
|
set -eU __fish_test_universal_variables_variable_foo
|
||||||
set -g foo bar
|
set -g __fish_test_universal_variables_variable_foo bar
|
||||||
begin
|
begin
|
||||||
set -l foo baz
|
set -l __fish_test_universal_variables_variable_foo baz
|
||||||
set -eg foo
|
set -eg __fish_test_universal_variables_variable_foo
|
||||||
end
|
end
|
||||||
|
|
||||||
if set -q foo
|
if set -q __fish_test_universal_variables_variable_foo
|
||||||
echo Test 10 fail
|
echo Test 10 fail
|
||||||
else
|
else
|
||||||
echo Test 10 pass
|
echo Test 10 pass
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
set foo abc def
|
set __fish_test_universal_variables_variable_foo abc def
|
||||||
set -e foo[1]
|
set -e __fish_test_universal_variables_variable_foo[1]
|
||||||
if test $foo '=' def
|
if test $__fish_test_universal_variables_variable_foo '=' def
|
||||||
echo Test 11 pass
|
echo Test 11 pass
|
||||||
else
|
else
|
||||||
echo Test 11 fail
|
echo Test 11 fail
|
||||||
|
@ -137,74 +137,74 @@ end
|
||||||
|
|
||||||
# Test combinations of export and scope
|
# Test combinations of export and scope
|
||||||
|
|
||||||
set -ge foo
|
set -ge __fish_test_universal_variables_variable_foo
|
||||||
|
|
||||||
set -Ue foo
|
set -Ue __fish_test_universal_variables_variable_foo
|
||||||
set -Ux foo bar
|
set -Ux __fish_test_universal_variables_variable_foo bar
|
||||||
set foo baz
|
set __fish_test_universal_variables_variable_foo baz
|
||||||
if test (/bin/sh -c 'echo $foo') = baz -a (../fish -c 'echo $foo') = baz
|
if test (/bin/sh -c 'echo $__fish_test_universal_variables_variable_foo') = baz -a (../fish -c 'echo $__fish_test_universal_variables_variable_foo') = baz
|
||||||
echo Test 12 pass
|
echo Test 12 pass
|
||||||
else
|
else
|
||||||
echo Test 12 fail
|
echo Test 12 fail
|
||||||
end
|
end
|
||||||
|
|
||||||
set -Ue foo
|
set -Ue __fish_test_universal_variables_variable_foo
|
||||||
set -Ux foo bar
|
set -Ux __fish_test_universal_variables_variable_foo bar
|
||||||
set -U foo baz
|
set -U __fish_test_universal_variables_variable_foo baz
|
||||||
if test (/bin/sh -c 'echo $foo') = baz -a (../fish -c 'echo $foo') = baz
|
if test (/bin/sh -c 'echo $__fish_test_universal_variables_variable_foo') = baz -a (../fish -c 'echo $__fish_test_universal_variables_variable_foo') = baz
|
||||||
echo Test 13 pass
|
echo Test 13 pass
|
||||||
else
|
else
|
||||||
echo Test 13 fail
|
echo Test 13 fail
|
||||||
end
|
end
|
||||||
|
|
||||||
set -Ux foo bar
|
set -Ux __fish_test_universal_variables_variable_foo bar
|
||||||
set -u foo bar
|
set -u __fish_test_universal_variables_variable_foo bar
|
||||||
if test (/bin/sh -c 'echo $foo') = '' -a (../fish -c 'echo $foo') = bar
|
if test (/bin/sh -c 'echo $__fish_test_universal_variables_variable_foo') = '' -a (../fish -c 'echo $__fish_test_universal_variables_variable_foo') = bar
|
||||||
echo Test 14 pass
|
echo Test 14 pass
|
||||||
else
|
else
|
||||||
echo Test 14 fail
|
echo Test 14 fail
|
||||||
end
|
end
|
||||||
|
|
||||||
set -Ux foo bar
|
set -Ux __fish_test_universal_variables_variable_foo bar
|
||||||
set -Uu foo baz
|
set -Uu __fish_test_universal_variables_variable_foo baz
|
||||||
if test (/bin/sh -c 'echo $foo') = '' -a (../fish -c 'echo $foo') = baz
|
if test (/bin/sh -c 'echo $__fish_test_universal_variables_variable_foo') = '' -a (../fish -c 'echo $__fish_test_universal_variables_variable_foo') = baz
|
||||||
echo Test 15 pass
|
echo Test 15 pass
|
||||||
else
|
else
|
||||||
echo Test 15 fail
|
echo Test 15 fail
|
||||||
end
|
end
|
||||||
|
|
||||||
set -eU foo
|
set -eU __fish_test_universal_variables_variable_foo
|
||||||
|
|
||||||
# test erasing variables without a specified scope
|
# test erasing variables without a specified scope
|
||||||
|
|
||||||
set -g test16res
|
set -g test16res
|
||||||
|
|
||||||
set -U foo universal
|
set -U __fish_test_universal_variables_variable_foo universal
|
||||||
set -g foo global
|
set -g __fish_test_universal_variables_variable_foo global
|
||||||
begin
|
begin
|
||||||
set -l foo blocklocal
|
set -l __fish_test_universal_variables_variable_foo blocklocal
|
||||||
function test16
|
function test16
|
||||||
set -l foo function
|
set -l __fish_test_universal_variables_variable_foo function
|
||||||
begin
|
begin
|
||||||
set -l foo functionblock
|
set -l __fish_test_universal_variables_variable_foo functionblock
|
||||||
|
|
||||||
set test16res $test16res (echo $foo)
|
set test16res $test16res (echo $__fish_test_universal_variables_variable_foo)
|
||||||
set -e foo
|
set -e __fish_test_universal_variables_variable_foo
|
||||||
set test16res $test16res (echo $foo)
|
set test16res $test16res (echo $__fish_test_universal_variables_variable_foo)
|
||||||
set -e foo
|
set -e __fish_test_universal_variables_variable_foo
|
||||||
set test16res $test16res (echo $foo)
|
set test16res $test16res (echo $__fish_test_universal_variables_variable_foo)
|
||||||
set -e foo
|
set -e __fish_test_universal_variables_variable_foo
|
||||||
set test16res $test16res (echo $foo)
|
set test16res $test16res (echo $__fish_test_universal_variables_variable_foo)
|
||||||
set -e foo
|
set -e __fish_test_universal_variables_variable_foo
|
||||||
set test16res $test16res (echo $foo)
|
set test16res $test16res (echo $__fish_test_universal_variables_variable_foo)
|
||||||
end
|
end
|
||||||
set test16res $test16res (echo $foo)
|
set test16res $test16res (echo $__fish_test_universal_variables_variable_foo)
|
||||||
set -e foo
|
set -e __fish_test_universal_variables_variable_foo
|
||||||
end
|
end
|
||||||
test16
|
test16
|
||||||
set test16res $test16res (echo $foo)
|
set test16res $test16res (echo $__fish_test_universal_variables_variable_foo)
|
||||||
end
|
end
|
||||||
set test16res $test16res (echo $foo)
|
set test16res $test16res (echo $__fish_test_universal_variables_variable_food)
|
||||||
|
|
||||||
#echo count: (count $test16res) "content:[$test16res]"
|
#echo count: (count $test16res) "content:[$test16res]"
|
||||||
|
|
||||||
|
@ -215,8 +215,8 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# clear foo for other shells
|
# clear for other shells
|
||||||
set -eU foo
|
set -eU __fish_test_universal_variables_variable_foo
|
||||||
|
|
||||||
# Test behavior of universals on startup (#1526)
|
# Test behavior of universals on startup (#1526)
|
||||||
echo Testing Universal Startup
|
echo Testing Universal Startup
|
||||||
|
|
Loading…
Reference in a new issue