Menu

unit test failed for simple app

wy163
2025-02-20
2025-02-22
  • wy163

    wy163 - 2025-02-20

    Hi, while running the unit tests for simple app, the case checking for multiline comments is failed. The test code is as below. The expected result of the test is to get an output "void f ( ) { }".

    static void comment_multiline()
    {
        const char code[] = "#define ABC {// \\\n"
                            "}\n"
                            "void f() ABC\n";
        ASSERT_EQUALS("\n\nvoid f ( ) { }", preprocess(code));
    }
    

    But as I understand, the translated result of "void f() ABC" should be "void f ( ) {". If we code the magic string in a real file, I think it should be as below.

    #define ABC {// \
    }
    void f() ABC
    

    If so, the ending brace should be commented. Maybe I misunderstand some basic knowledge, but I can't figure it out. Could you please give some help with this? Thanks a lot!

     
  • CHR

    CHR - 2025-02-21

    clang and gcc seem to agree with your assessment. You should probably open an issue here: https://github.com/danmar/simplecpp/issues

     
  • wy163

    wy163 - 2025-02-22

    Hi CHR, thanks for comments, I opened an issue: https://github.com/danmar/simplecpp/issues/419

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.