VariableExpression: Restrict CharClass.Mixed to middle of identifiers

This commit is contained in:
atlimit8
2017-04-15 20:56:19 -05:00
parent f9974624c8
commit c34b947e43
2 changed files with 24 additions and 4 deletions

View File

@@ -351,13 +351,24 @@ namespace OpenRA.Test
public void TestParseHyphenErrors()
{
AssertParseFailure("-", "Missing value or sub-expression at end for `-` operator");
AssertParseFailure("t- 1", "Missing binary operation before `1` at index 3");
AssertParseFailure("t -1", "Missing binary operation before `-1` at index 2");
AssertParseFailure("-1-1", "Missing binary operation before `-1` at index 2");
AssertParseFailure("5-1", "Missing binary operation before `-1` at index 1");
AssertParseFailure("6 -3", "Missing binary operation before `-3` at index 2");
}
[TestCase(TestName = "Test mixed charaters at end of identifier parser errors")]
public void TestParseMixedEndErrors()
{
AssertParseFailure("t- 1", "Invalid identifier end character at index 1 for `t-`");
AssertParseFailure("t-", "Invalid identifier end character at index 1 for `t-`");
AssertParseFailure("t. 1", "Invalid identifier end character at index 1 for `t.`");
AssertParseFailure("t.", "Invalid identifier end character at index 1 for `t.`");
AssertParseFailure("t@ 1", "Invalid identifier end character at index 1 for `t@`");
AssertParseFailure("t@", "Invalid identifier end character at index 1 for `t@`");
AssertParseFailure("t$ 1", "Invalid identifier end character at index 1 for `t$`");
AssertParseFailure("t$", "Invalid identifier end character at index 1 for `t$`");
}
[TestCase(TestName = "Undefined symbols are treated as `false` (0) values")]
public void TestUndefinedSymbols()
{