Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/job-compile-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ jobs:
run: yarn test --scenario=SimpleCppProject
working-directory: Extension

- name: Run CppModulesProject tests (Windows)
if: ${{ inputs.platform == 'windows' }}
run: yarn test --scenario=CppModulesProject
working-directory: Extension

- name: Run E2E IntelliSense features tests (Windows)
if: ${{ inputs.platform == 'windows' }}
run: yarn test --scenario=MultirootDeadlockTest
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated at runtime by the scenario tests.
.vscode/
build/
Empty file.
Empty file.
27 changes: 27 additions & 0 deletions Extension/test/scenarios/CppModulesProject/assets/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Module importer used by the compile_commands.json based tests.
//
// Diagnostics on the import statements are expected until IntelliSense
// support for C++20 modules is available for all compilers
// (https://github.com/microsoft/vscode-cpptools/issues/6302).

import math;
import geometry;

// Sentinel probe: this define is only provided by the compile_commands.json
// entry for this file. The test hovers on the use of the symbol below to
// verify that the compilation database entry -- including its module related
// flags -- was actually applied to this translation unit, rather than
// IntelliSense falling back to a default configuration.
#ifdef CPPMODULES_COMPILE_COMMANDS_SENTINEL
int compile_database_sentinel_value = 1;
#endif

int probe_compile_database()
{
return compile_database_sentinel_value;
}

int main()
{
return add(1, 2) + square_area(3) - math::k_answer;
}
23 changes: 23 additions & 0 deletions Extension/test/scenarios/CppModulesProject/assets/main2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Module importer used by the custom configuration provider tests
// (GCC-style module compiler arguments).

import math;
import geometry;

// Sentinel probe: this define is only provided through the compilerArgs of the
// custom configuration provider used by the tests. The hover assertion proves
// that the provider's arguments (which also carry the GCC module flags) were
// delivered to the language server for this translation unit.
#ifdef PROVIDER_GCC_SENTINEL
int provider_gcc_sentinel_value = 1;
#endif

int probe_provider_gcc()
{
return provider_gcc_sentinel_value;
}

int main()
{
return add(2, 3) + square_area(4) - math::k_answer;
}
23 changes: 23 additions & 0 deletions Extension/test/scenarios/CppModulesProject/assets/main3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Module importer used by the custom configuration provider tests
// (MSVC-style module compiler arguments).

import math;
import geometry;

// Sentinel probe: this define is only provided through the compilerArgs of the
// custom configuration provider used by the tests. The hover assertion proves
// that the provider's arguments (which also carry the MSVC module arguments)
// were delivered to the language server for this translation unit.
#ifdef PROVIDER_MSVC_SENTINEL
int provider_msvc_sentinel_value = 1;
#endif

int probe_provider_msvc()
{
return provider_msvc_sentinel_value;
}

int main()
{
return add(3, 4) + square_area(5) - math::k_answer;
}
24 changes: 24 additions & 0 deletions Extension/test/scenarios/CppModulesProject/assets/math.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Module interface unit using the GCC-style file extension (.cppm).
//
// IntelliSense support for C++20 modules is tracked at
// https://github.com/microsoft/vscode-cpptools/issues/6302. These sources are
// used by the CppModulesProject scenario tests to cover the extension-side
// behavior that module based projects rely on.

export module math;

export int add(int a, int b)
{
return a + b;
}

export namespace math
{
constexpr int k_answer = 42;
}

// Not exported; part of the module implementation only.
int implementation_detail()
{
return math::k_answer;
}
13 changes: 13 additions & 0 deletions Extension/test/scenarios/CppModulesProject/assets/math.ixx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Module interface unit using the MSVC-style file extension (.ixx).
//
// IntelliSense support for C++20 modules is tracked at
// https://github.com/microsoft/vscode-cpptools/issues/6302. These sources are
// used by the CppModulesProject scenario tests to cover the extension-side
// behavior that module based projects rely on.

export module geometry;

export int square_area(int side)
{
return side * side;
}
Loading