Skip to content

bug: gtest's ASSERT_DEBUG_DEATH not treated as an expression_statement #328

@mrwsl

Description

@mrwsl

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-cpp

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

tree-sitter 0.25.8 (f2f197b6b27ce75c280c20f131d4f71e906b86f7)

Describe the bug

google test's ASSERT_DEBUG_DEATH is not treated as an expression_statement like other test macros. See the picture from the treesitter playground:

Image

EXPECT_FALSE is correctly shown as an expression statement while ASSERT_DEBUG_DEATH leads to an error. It has to do with the initialization of the class inside the macro.

Steps To Reproduce/Bad Parse Tree

  1. use gtest's assert debug death macro with an initialization inside it.
  2. tree-sitter can't parse the code

Expected Behavior/Parse Tree

The macro is resolved to an expression statement

Repro

EXPECT_FALSE( bool );
ASSERT_DEBUG_DEATH( const class Class() , "" );

class MockStream {
  public:
    MockStream(){};
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions