-
Notifications
You must be signed in to change notification settings - Fork 36
Fixed inspect request using Preamble approach #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vgvassilev
merged 1 commit into
compiler-research:main
from
anutosh491:Implement_preamble
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ dependencies: | |
- jupyter_kernel_test>=0.4.3 | ||
- nbval | ||
- pytest-rerunfailures | ||
- doctest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
############################################################################# | ||
# Copyright (c) 2023, xeus-cpp contributors # | ||
# # | ||
# Distributed under the terms of the BSD 3-Clause License. # | ||
# # | ||
# The full license is in the file LICENSE, distributed with this software. # | ||
############################################################################# | ||
|
||
|
||
# Unit tests | ||
# ========== | ||
|
||
cmake_minimum_required(VERSION 3.1) | ||
|
||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) | ||
project(xeus-cpp-test) | ||
|
||
enable_testing() | ||
|
||
find_package(xeus-cpp REQUIRED CONFIG) | ||
endif() | ||
|
||
include(CheckCXXCompilerFlag) | ||
|
||
string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE) | ||
|
||
if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Intel) | ||
add_compile_options(-Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion) | ||
|
||
CHECK_CXX_COMPILER_FLAG(-march=native HAS_MARCH_NATIVE) | ||
if (HAS_MARCH_NATIVE) | ||
add_compile_options(-march=native) | ||
endif() | ||
endif() | ||
|
||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) | ||
add_compile_options(/EHsc /MP /bigobj) | ||
add_link_options(/MANIFEST:NO) | ||
endif() | ||
|
||
find_package(doctest) | ||
find_package(Threads) | ||
|
||
set(XEUS_CPP_TESTS | ||
main.cpp | ||
test_interpreter.cpp | ||
) | ||
|
||
add_executable(test_xeus_cpp ${XEUS_CPP_TESTS}) | ||
|
||
if (APPLE) | ||
set_target_properties(test_xeus_cpp PROPERTIES | ||
MACOSX_RPATH ON | ||
) | ||
else() | ||
set_target_properties(test_xeus_cpp PROPERTIES | ||
BUILD_WITH_INSTALL_RPATH 1 | ||
SKIP_BUILD_RPATH FALSE | ||
) | ||
endif() | ||
|
||
set_target_properties(test_xeus_cpp PROPERTIES | ||
INSTALL_RPATH_USE_LINK_PATH TRUE | ||
) | ||
|
||
target_link_libraries(test_xeus_cpp xeus-cpp doctest::doctest ${CMAKE_THREAD_LIBS_INIT}) | ||
target_include_directories(test_xeus_cpp PRIVATE ${XEUS_CPP_INCLUDE_DIR}) | ||
|
||
add_custom_target(xtest COMMAND test_xeus_cpp DEPENDS test_xeus_cpp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*************************************************************************** | ||
* Copyright (c) 2023, xeus-cpp contributors | ||
* | ||
* Distributed under the terms of the BSD 3-Clause License. | ||
* | ||
* The full license is in the file LICENSE, distributed with this software. | ||
****************************************************************************/ | ||
|
||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN | ||
#include "doctest/doctest.h" | ||
anutosh491 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*************************************************************************** | ||
* Copyright (c) 2023, xeus-cpp contributors | ||
* | ||
* Distributed under the terms of the BSD 3-Clause License. | ||
* | ||
* The full license is in the file LICENSE, distributed with this software. | ||
****************************************************************************/ | ||
|
||
#include "doctest/doctest.h" | ||
#include "xeus-cpp/xinterpreter.hpp" | ||
|
||
TEST_SUITE("execute_request") | ||
{ | ||
TEST_CASE("fetch_documentation") | ||
{ | ||
|
||
xcpp::interpreter interpreter(0, nullptr); | ||
|
||
std::string code = "?std::vector"; | ||
std::string inspect_result = "https://en.cppreference.com/w/cpp/container/vector"; | ||
nl::json user_expressions = nl::json::object(); | ||
|
||
nl::json result = interpreter.execute_request( | ||
code, | ||
false, | ||
false, | ||
user_expressions, | ||
false | ||
); | ||
|
||
REQUIRE(result["payload"][0]["data"]["text/plain"] == inspect_result); | ||
REQUIRE(result["user_expressions"] == nl::json::object()); | ||
REQUIRE(result["found"] == true); | ||
REQUIRE(result["status"] == "ok"); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.