aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--fish_tests.c18
-rw-r--r--tests/test3.in26
-rw-r--r--tests/test3.out2
-rw-r--r--tests/test4.in2
-rw-r--r--tests/test4.out2
5 files changed, 39 insertions, 11 deletions
diff --git a/fish_tests.c b/fish_tests.c
index 5cde0bd3..2b83ee71 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 26942a02..7346dc84 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 9ae93fd4..a0c33cec 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 75c2c7ec..0966694a 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 3c2d17b6..54f64544 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