File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2990,6 +2990,43 @@ static void fuzz_crash()
29902990 }
29912991}
29922992
2993+ static void same_name ()
2994+ {
2995+ const char code[] = " #include <header_a.h>\n "
2996+ " #include <header_b.h>\n "
2997+ " TEST\n " ;
2998+
2999+ simplecpp::DUI dui;
3000+ dui.includePaths .push_back (" ./testsuite/path-tests/include_a" );
3001+ dui.includePaths .push_back (" ./testsuite/path-tests/include_b" );
3002+
3003+ ASSERT_EQUALS (" \n\n OK" , preprocess (code, dui));
3004+ }
3005+
3006+ static void file_id ()
3007+ {
3008+ const char code[] = " #include \" once.h\"\n "
3009+ " #include \" Once.h\"\n "
3010+
3011+ " #include <once.h>\n "
3012+ " #include <Once.h>\n "
3013+
3014+ " #include \" ../path-tests/once.h\"\n "
3015+ " #include \" ../path-tests/Once.h\"\n "
3016+ " #include \" ../Path-Tests/once.h\"\n "
3017+ " #include \" ../Path-Tests/Once.h\"\n "
3018+
3019+ " #include \" include_a/../once.h\"\n "
3020+ " #include \" include_a/../Once.h\"\n "
3021+ " #include \" include_A/../once.h\"\n "
3022+ " #include \" include_A/../Once.h\"\n " ;
3023+
3024+ simplecpp::DUI dui;
3025+ dui.includePaths .push_back (" ./testsuite/path-tests" );
3026+
3027+ ASSERT_EQUALS (" \n #line 2 \" testsuite/path-tests/once.h\"\n ONCE" , preprocess (code, dui));
3028+ }
3029+
29933030int main (int argc, char **argv)
29943031{
29953032 TEST_CASE (backslash);
@@ -3212,6 +3249,10 @@ int main(int argc, char **argv)
32123249
32133250 TEST_CASE (warning);
32143251
3252+ // path resolution
3253+ TEST_CASE (same_name);
3254+ TEST_CASE (file_id);
3255+
32153256 // utility functions.
32163257 TEST_CASE (simplifyPath);
32173258 TEST_CASE (simplifyPath_cppcheck);
Original file line number Diff line number Diff line change 1+ #include "same_name.h"
Original file line number Diff line number Diff line change 1+ #define TEST E
Original file line number Diff line number Diff line change 1+ #include "same_name.h"
Original file line number Diff line number Diff line change 1+ #define TEST OK
Original file line number Diff line number Diff line change 1+ #pragma once
2+ ONCE
You can’t perform that action at this time.
0 commit comments