diff --git a/test/ast_checks/unary_expressions.d b/test/ast_checks/unary_expressions.d new file mode 100644 index 00000000..11497ef6 --- /dev/null +++ b/test/ast_checks/unary_expressions.d @@ -0,0 +1,18 @@ +unittest { i++; } +unittest { ++i; } +unittest { i--; } +unittest { --i; } +unittest { i -= +j; } +unittest { i += -j; } +unittest { i -= ~j; } +unittest { i += !j; } +unittest { i -= *j; } +unittest { i += &j; } +unittest { i = cast(int)j; } +unittest { x = assert(0); } +unittest { x = throw y; } +unittest { x = delete f; } +unittest { x = new F(); } +unittest { + *&~(+1 | (int).init).new T(2); +} \ No newline at end of file diff --git a/test/ast_checks/unary_expressions.txt b/test/ast_checks/unary_expressions.txt new file mode 100644 index 00000000..046dd8ef --- /dev/null +++ b/test/ast_checks/unary_expressions.txt @@ -0,0 +1,21 @@ +/module/declaration[1]/unittest/blockStatement//expression/plusPlusPostfixUnaryExpression//identifier +/module/declaration[2]/unittest/blockStatement//expression/plusPlusPrefixUnaryExpression//identifier +/module/declaration[3]/unittest/blockStatement//expression/minusMinusPostfixUnaryExpression//identifier +/module/declaration[4]/unittest/blockStatement//expression/minusMinusPrefixUnaryExpression//identifier +/module/declaration[5]/unittest/blockStatement//expression/expression[@operator="-="]/plusPrefixUnaryExpression +/module/declaration[6]/unittest/blockStatement//expression/expression[@operator="+="]/minusPrefixUnaryExpression +/module/declaration[7]/unittest/blockStatement//expression/expression[@operator="-="]/tildePrefixUnaryExpression +/module/declaration[8]/unittest/blockStatement//expression/expression[@operator="+="]/notPrefixUnaryExpression +/module/declaration[9]/unittest/blockStatement//expression/expression[@operator="-="]/derefPrefixUnaryExpression +/module/declaration[10]/unittest/blockStatement//expression/expression[@operator="+="]/refPrefixUnaryExpression +/module/declaration[11]/unittest/blockStatement//expression/expression[@operator="="]/castExpression/type[@pretty="int"] +/module/declaration[11]/unittest/blockStatement//expression/expression[@operator="="]/castExpression/primaryExpression/identifierOrTemplateInstance/identifier[text()="j"] +/module/declaration[12]/unittest/blockStatement//expression/expression[@operator="="]/assertExpression/assertArguments/primaryExpression/intLiteral[text()="0"] +/module/declaration[13]/unittest/blockStatement//expression/expression[@operator="="]/throwExpression/primaryExpression/identifierOrTemplateInstance/identifier[text()="y"] +/module/declaration[14]/unittest/blockStatement//expression/expression[@operator="="]/deleteExpression/primaryExpression/identifierOrTemplateInstance/identifier[text()="f"] +/module/declaration[15]/unittest/blockStatement//expression/expression[@operator="="]/newExpression/type[@pretty="F"] +/module/declaration[16]/unittest/blockStatement//expression/derefPrefixUnaryExpression/refPrefixUnaryExpression/tildePrefixUnaryExpression/unaryDotNewExpression/primaryExpression/expression/orExpression/plusPrefixUnaryExpression +/module/declaration[16]/unittest/blockStatement//expression/derefPrefixUnaryExpression/refPrefixUnaryExpression/tildePrefixUnaryExpression/unaryDotNewExpression/primaryExpression/expression/orExpression/typeDotIdentifierExpression/type[@pretty="int"] +/module/declaration[16]/unittest/blockStatement//expression/derefPrefixUnaryExpression/refPrefixUnaryExpression/tildePrefixUnaryExpression/unaryDotNewExpression/primaryExpression/expression/orExpression/typeDotIdentifierExpression/identifierOrTemplateInstance/identifier[text()="init"] +/module/declaration[16]/unittest/blockStatement//expression/derefPrefixUnaryExpression/refPrefixUnaryExpression/tildePrefixUnaryExpression/unaryDotNewExpression/newExpression/type[@pretty="T"] +/module/declaration[16]/unittest/blockStatement//expression/derefPrefixUnaryExpression/refPrefixUnaryExpression/tildePrefixUnaryExpression/unaryDotNewExpression/newExpression/arguments//primaryExpression/intLiteral[text()="2"]