Skip to content

#ifdef and #ifndef directives missing from ifCond #688

Description

@ludviggunne

Failing test:

    {
        const char code[] = "#ifdef NOTDEFINED\n"
                            "#endif\n"
                            "#ifndef NOTDEFINED\n"
                            "#endif\n";
        std::list<simplecpp::IfCond> ifCond;
        ASSERT_EQUALS("", preprocess(code, &ifCond));
        ASSERT_EQUALS(2, ifCond.size());
        auto it = ifCond.cbegin();
        ASSERT_EQUALS(0, it->location.fileIndex);
        ASSERT_EQUALS(1, it->location.line);
        ASSERT_EQUALS(2, it->location.col);
        ASSERT_EQUALS("defined(NOTDEFINED)", it->E);
        ASSERT_EQUALS(0, it->result);
        ++it;
        ASSERT_EQUALS(0, it->location.fileIndex);
        ASSERT_EQUALS(3, it->location.line);
        ASSERT_EQUALS(2, it->location.col);
        ASSERT_EQUALS("!defined(NOTDEFINED)", it->E);
        ASSERT_EQUALS(1, it->result);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions