Skip to content

cpp_assert does not trigger on an empty string #135

@zachcran

Description

@zachcran

Describe the bug
The condition parameter (cond) of cpp_assert(cond desc) is documented as "This can be anything that can be passed to CMake’s if statement". When cond evaluates to false in an if statement, the assert should crash the program. An empty string evaluates to false in CMake's if statement, but does not trigger cpp_assert.

To Reproduce
The following code will not trigger the assertion that would print "Empty string!" and crash the program, instead printing "The program did not crash.".

cpp_assert("" "Empty string!")
message("The program did not crash.")

Expected behavior
The assert should be triggered, printing "Empty string!" and crashing the program.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions