Disallow backgrounding in conditionals and before and/or bool statements

Fixes #1136
This commit is contained in:
ridiculousfish
2014-11-02 13:11:27 -08:00
parent c33a3862cc
commit c31ad3ed07
6 changed files with 144 additions and 21 deletions

View File

@@ -691,7 +691,37 @@ static void test_parser()
{
err(L"Bad escape in nested command substitution not reported as error");
}
if (! parse_util_detect_errors(L"false & ; and cat"))
{
err(L"'and' command after background not reported as error");
}
if (! parse_util_detect_errors(L"true & ; or cat"))
{
err(L"'or' command after background not reported as error");
}
if (parse_util_detect_errors(L"true & ; not cat"))
{
err(L"'not' command after background falsely reported as error");
}
if (! parse_util_detect_errors(L"if true & ; end"))
{
err(L"backgrounded 'if' conditional not reported as error");
}
if (! parse_util_detect_errors(L"if false; else if true & ; end"))
{
err(L"backgrounded 'else if' conditional not reported as error");
}
if (! parse_util_detect_errors(L"while true & ; end"))
{
err(L"backgrounded 'while' conditional not reported as error");
}
say(L"Testing basic evaluation");
#if 0