From 20e5d298a064ceed0dadb25d8241cec55e95f34a Mon Sep 17 00:00:00 2001 From: axel Date: Mon, 5 Jun 2006 23:31:33 +1000 Subject: [PATCH] Updates, bugfixing and minor edits on the test suite darcs-hash:20060605133133-ac50b-e2ee5868f9f3ede147c7059d90c0f520ed905a5f.gz --- fish_tests.c | 18 +++++++++--------- tests/test3.in | 26 ++++++++++++++++++++++++++ tests/test3.out | 2 ++ tests/test4.in | 2 +- tests/test4.out | 2 +- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/fish_tests.c b/fish_tests.c index 5cde0bd39..2b83ee713 100644 --- a/fish_tests.c +++ b/fish_tests.c @@ -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" ); } diff --git a/tests/test3.in b/tests/test3.in index 26942a023..7346dc84f 100644 --- a/tests/test3.in +++ b/tests/test3.in @@ -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 \ No newline at end of file diff --git a/tests/test3.out b/tests/test3.out index 9ae93fd4b..a0c33cec7 100644 --- a/tests/test3.out +++ b/tests/test3.out @@ -7,3 +7,5 @@ Test 6 pass Test 7 pass Test 8 pass Test 9 pass +Test 10 pass +Test 11 pass diff --git a/tests/test4.in b/tests/test4.in index 75c2c7ecf..0966694aa 100644 --- a/tests/test4.in +++ b/tests/test4.in @@ -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 diff --git a/tests/test4.out b/tests/test4.out index 3c2d17b67..54f64544b 100644 --- a/tests/test4.out +++ b/tests/test4.out @@ -1,4 +1,4 @@ Test 1 pass Test 2 pass Test 3 pass -Test 4 fail +Test 4 pass