Ejemplo n.º 1
0
TEST(libclang, VirtualFileOverlay_CaseInsensitive) {
  const char *contents =
      "{\n"
      "  'version': 0,\n"
      "  'case-sensitive': 'false',\n"
      "  'roots': [\n"
      "    {\n"
      "      'type': 'directory',\n"
      "      'name': \"/path/virtual\",\n"
      "      'contents': [\n"
      "        {\n"
      "          'type': 'file',\n"
      "          'name': \"foo.h\",\n"
      "          'external-contents': \"/real/foo.h\"\n"
      "        }\n"
      "      ]\n"
      "    }\n"
      "  ]\n"
      "}\n";
  TestVFO T(contents);
  T.map("/path/virtual/foo.h", "/real/foo.h");
  clang_VirtualFileOverlay_setCaseSensitivity(T.VFO, false);
}
Ejemplo n.º 2
0
TEST(libclang, VirtualFileOverlay) {
  {
    const char *contents =
    "{\n"
    "  'version': 0,\n"
    "  'roots': [\n"
    "    {\n"
    "      'type': 'directory',\n"
    "      'name': \"/path/virtual\",\n"
    "      'contents': [\n"
    "        {\n"
    "          'type': 'file',\n"
    "          'name': \"foo.h\",\n"
    "          'external-contents': \"/real/foo.h\"\n"
    "        }\n"
    "      ]\n"
    "    }\n"
    "  ]\n"
    "}\n";
    TestVFO T(contents);
    T.map("/path/virtual/foo.h", "/real/foo.h");
  }
  {
    TestVFO T(NULL);
    T.mapError("/path/./virtual/../foo.h", "/real/foo.h",
               CXError_InvalidArguments);
  }
  {
    const char *contents =
    "{\n"
    "  'version': 0,\n"
    "  'roots': [\n"
    "    {\n"
    "      'type': 'directory',\n"
    "      'name': \"/another/dir\",\n"
    "      'contents': [\n"
    "        {\n"
    "          'type': 'file',\n"
    "          'name': \"foo2.h\",\n"
    "          'external-contents': \"/real/foo2.h\"\n"
    "        }\n"
    "      ]\n"
    "    },\n"
    "    {\n"
    "      'type': 'directory',\n"
    "      'name': \"/path/virtual/dir\",\n"
    "      'contents': [\n"
    "        {\n"
    "          'type': 'file',\n"
    "          'name': \"foo1.h\",\n"
    "          'external-contents': \"/real/foo1.h\"\n"
    "        },\n"
    "        {\n"
    "          'type': 'file',\n"
    "          'name': \"foo3.h\",\n"
    "          'external-contents': \"/real/foo3.h\"\n"
    "        },\n"
    "        {\n"
    "          'type': 'directory',\n"
    "          'name': \"in/subdir\",\n"
    "          'contents': [\n"
    "            {\n"
    "              'type': 'file',\n"
    "              'name': \"foo4.h\",\n"
    "              'external-contents': \"/real/foo4.h\"\n"
    "            }\n"
    "          ]\n"
    "        }\n"
    "      ]\n"
    "    }\n"
    "  ]\n"
    "}\n";
    TestVFO T(contents);
    T.map("/path/virtual/dir/foo1.h", "/real/foo1.h");
    T.map("/another/dir/foo2.h", "/real/foo2.h");
    T.map("/path/virtual/dir/foo3.h", "/real/foo3.h");
    T.map("/path/virtual/dir/in/subdir/foo4.h", "/real/foo4.h");
  }
  {
    const char *contents =
    "{\n"
    "  'version': 0,\n"
    "  'case-sensitive': 'false',\n"
    "  'roots': [\n"
    "    {\n"
    "      'type': 'directory',\n"
    "      'name': \"/path/virtual\",\n"
    "      'contents': [\n"
    "        {\n"
    "          'type': 'file',\n"
    "          'name': \"foo.h\",\n"
    "          'external-contents': \"/real/foo.h\"\n"
    "        }\n"
    "      ]\n"
    "    }\n"
    "  ]\n"
    "}\n";
    TestVFO T(contents);
    T.map("/path/virtual/foo.h", "/real/foo.h");
    clang_VirtualFileOverlay_setCaseSensitivity(T.VFO, false);
  }
}