Skip to content

Commit

Permalink
added missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 committed Apr 7, 2023
1 parent c1041a7 commit a75a23e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/ast_checks/unary_expressions.d
Original file line number Diff line number Diff line change
@@ -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);
}
21 changes: 21 additions & 0 deletions test/ast_checks/unary_expressions.txt
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit a75a23e

Please sign in to comment.