mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Updates, bugfixing and minor edits on the test suite
darcs-hash:20060605133133-ac50b-e2ee5868f9f3ede147c7059d90c0f520ed905a5f.gz
This commit is contained in:
parent
39e9974e71
commit
20e5d298a0
5 changed files with 39 additions and 11 deletions
18
fish_tests.c
18
fish_tests.c
|
@ -483,43 +483,43 @@ static void test_parser()
|
||||||
|
|
||||||
|
|
||||||
say( L"Testing null input to parser" );
|
say( L"Testing null input to parser" );
|
||||||
if( !parser_test( 0, 0 ) )
|
if( !parser_test( 0, 0, 0 ) )
|
||||||
{
|
{
|
||||||
err( L"Null input to parser_test undetected" );
|
err( L"Null input to parser_test undetected" );
|
||||||
}
|
}
|
||||||
|
|
||||||
say( L"Testing block nesting" );
|
say( L"Testing block nesting" );
|
||||||
if( !parser_test( L"if; end", 0 ) )
|
if( !parser_test( L"if; end", 0, 0 ) )
|
||||||
{
|
{
|
||||||
err( L"Incomplete if statement undetected" );
|
err( L"Incomplete if statement undetected" );
|
||||||
}
|
}
|
||||||
if( !parser_test( L"if test; echo", 0 ) )
|
if( !parser_test( L"if test; echo", 0, 0 ) )
|
||||||
{
|
{
|
||||||
err( L"Missing end undetected" );
|
err( L"Missing end undetected" );
|
||||||
}
|
}
|
||||||
if( !parser_test( L"if test; end; end", 0 ) )
|
if( !parser_test( L"if test; end; end", 0, 0 ) )
|
||||||
{
|
{
|
||||||
err( L"Unbalanced end undetected" );
|
err( L"Unbalanced end undetected" );
|
||||||
}
|
}
|
||||||
|
|
||||||
say( L"Testing detection of invalid use of builtin commands" );
|
say( L"Testing detection of invalid use of builtin commands" );
|
||||||
if( !parser_test( L"case foo", 0 ) )
|
if( !parser_test( L"case foo", 0, 0 ) )
|
||||||
{
|
{
|
||||||
err( L"'case' command outside of block context undetected" );
|
err( L"'case' command outside of block context undetected" );
|
||||||
}
|
}
|
||||||
if( !parser_test( L"switch ggg; if true; case foo;end;end", 0 ) )
|
if( !parser_test( L"switch ggg; if true; case foo;end;end", 0, 0 ) )
|
||||||
{
|
{
|
||||||
err( L"'case' command outside of switch block context undetected" );
|
err( L"'case' command outside of switch block context undetected" );
|
||||||
}
|
}
|
||||||
if( !parser_test( L"else", 0 ) )
|
if( !parser_test( L"else", 0, 0 ) )
|
||||||
{
|
{
|
||||||
err( L"'else' command outside of conditional block context undetected" );
|
err( L"'else' command outside of conditional block context undetected" );
|
||||||
}
|
}
|
||||||
if( !parser_test( L"break", 0 ) )
|
if( !parser_test( L"break", 0, 0 ) )
|
||||||
{
|
{
|
||||||
err( L"'break' command outside of loop block context undetected" );
|
err( L"'break' command outside of loop block context undetected" );
|
||||||
}
|
}
|
||||||
if( !parser_test( L"exec ls|less", 0 ) || !parser_test( L"echo|return", 0 ))
|
if( !parser_test( L"exec ls|less", 0, 0 ) || !parser_test( L"echo|return", 0, 0 ))
|
||||||
{
|
{
|
||||||
err( L"Invalid pipe command undetected" );
|
err( L"Invalid pipe command undetected" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,5 +111,31 @@ else
|
||||||
echo Test 9 pass
|
echo Test 9 pass
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Test erasing variables in specific scope
|
||||||
|
|
||||||
|
set -eU foo
|
||||||
|
set -g foo bar
|
||||||
|
begin
|
||||||
|
set -l foo baz
|
||||||
|
set -eg foo
|
||||||
|
end
|
||||||
|
|
||||||
|
if set -q foo
|
||||||
|
echo Test 10 fail
|
||||||
|
else
|
||||||
|
echo Test 10 pass
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# Test universal variable erasing
|
||||||
|
|
||||||
|
set -e foo
|
||||||
|
../fish -c "set -U foo bar"
|
||||||
|
|
||||||
|
if set -q foo
|
||||||
|
echo Test 11 pass
|
||||||
|
else
|
||||||
|
echo Test 11 fail
|
||||||
|
end
|
||||||
|
|
||||||
|
set -eU foo
|
|
@ -7,3 +7,5 @@ Test 6 pass
|
||||||
Test 7 pass
|
Test 7 pass
|
||||||
Test 8 pass
|
Test 8 pass
|
||||||
Test 9 pass
|
Test 9 pass
|
||||||
|
Test 10 pass
|
||||||
|
Test 11 pass
|
||||||
|
|
|
@ -26,7 +26,7 @@ setter; if test $smurf = green; echo Test 3 pass; else; echo Test 3 fail; end
|
||||||
end
|
end
|
||||||
|
|
||||||
function call4
|
function call4
|
||||||
unsetter; if test !$smurf; echo Test 4 pass; else; echo Test 4 fail; end
|
unsetter; if not set -q smurf; echo Test 4 pass; else; echo Test 4 fail; end
|
||||||
end
|
end
|
||||||
|
|
||||||
set -g smurf yellow
|
set -g smurf yellow
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Test 1 pass
|
Test 1 pass
|
||||||
Test 2 pass
|
Test 2 pass
|
||||||
Test 3 pass
|
Test 3 pass
|
||||||
Test 4 fail
|
Test 4 pass
|
||||||
|
|
Loading…
Reference in a new issue