1+ #include " gtest/gtest.h"
2+ #include " clang/Lex/HeaderSearchOptions.h"
3+ #include " llvm/ADT/SmallVector.h"
4+ #include < string>
5+ #include < algorithm>
6+
7+
8+ #include " ../../lib/CppInterOp/Paths.h"
9+
10+ namespace {
11+
12+ TEST (PathsTest, CopyIncludePathsEdgeCases) {
13+ clang::HeaderSearchOptions Opts;
14+
15+ // Set up edge-case flags to trigger uncovered branches
16+ Opts.ModuleCachePath = " /tmp/fake_cache" ; // Triggers -fmodule-cache-path
17+ Opts.UseStandardSystemIncludes = false ; // Triggers -nostdinc
18+ Opts.UseStandardCXXIncludes = false ; // Triggers -nostdinc++
19+ Opts.UseLibcxx = true ; // Triggers -stdlib=libc++
20+ Opts.Verbose = true ; // Triggers -v
21+
22+ llvm::SmallVector<std::string, 16 > IncPaths;
23+
24+ CppInternal::utils::CopyIncludePaths (Opts, IncPaths, true , true );
25+
26+ auto Contains = [&](const std::string& flag) {
27+ return std::find (IncPaths.begin (), IncPaths.end (), flag) != IncPaths.end ();
28+ };
29+
30+ // Verify the results
31+ EXPECT_TRUE (Contains (" -fmodule-cache-path" ));
32+ EXPECT_TRUE (Contains (" /tmp/fake_cache" ));
33+ EXPECT_TRUE (Contains (" -nostdinc" ));
34+ EXPECT_TRUE (Contains (" -nostdinc++" ));
35+ EXPECT_TRUE (Contains (" -stdlib=libc++" ));
36+ EXPECT_TRUE (Contains (" -v" ));
37+ }
38+
39+ } // end anonymous namespace
0 commit comments