Updates, bugfixing and minor edits on the test suite

darcs-hash:20060605133133-ac50b-e2ee5868f9f3ede147c7059d90c0f520ed905a5f.gz
This commit is contained in:
axel 2006-06-05 23:31:33 +10:00
parent 39e9974e71
commit 20e5d298a0
5 changed files with 39 additions and 11 deletions

View File

@ -483,43 +483,43 @@ static void test_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" );
}
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" );
}
if( !parser_test( L"if test; echo", 0 ) )
if( !parser_test( L"if test; echo", 0, 0 ) )
{
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" );
}
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" );
}
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" );
}
if( !parser_test( L"else", 0 ) )
if( !parser_test( L"else", 0, 0 ) )
{
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" );
}
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" );
}

View File

@ -111,5 +111,31 @@ else
echo Test 9 pass
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

View File

@ -7,3 +7,5 @@ Test 6 pass
Test 7 pass
Test 8 pass
Test 9 pass
Test 10 pass
Test 11 pass

View File

@ -26,7 +26,7 @@ setter; if test $smurf = green; echo Test 3 pass; else; echo Test 3 fail; end
end
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
set -g smurf yellow

View File

@ -1,4 +1,4 @@
Test 1 pass
Test 2 pass
Test 3 pass
Test 4 fail
Test 4 pass