Skip to content
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

Corrosion tests should not test C++ features not used by Corrosion it… #184

Merged
merged 2 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions test/cpp2rust/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ corrosion_import_crate(MANIFEST_PATH rust/Cargo.toml)
corrosion_link_libraries(rust-exe cpp-lib cpp-lib2 cpp-lib3)

add_library(cpp-lib lib.cpp)
target_compile_features(cpp-lib PRIVATE cxx_std_17)
target_compile_features(cpp-lib PRIVATE cxx_std_14)
set_target_properties(
cpp-lib
PROPERTIES
POSITION_INDEPENDENT_CODE ON
)

add_library(cpp-lib2 lib2.cpp )
target_compile_features(cpp-lib2 PRIVATE cxx_std_17)
target_compile_features(cpp-lib2 PRIVATE cxx_std_14)
set_target_properties(
cpp-lib2
PROPERTIES
POSITION_INDEPENDENT_CODE ON
)

add_library(cpp-lib3 "path with space/lib3.cpp" )
target_compile_features(cpp-lib3 PRIVATE cxx_std_17)
target_compile_features(cpp-lib3 PRIVATE cxx_std_14)
set_target_properties(
cpp-lib3
PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
)
4 changes: 1 addition & 3 deletions test/cpp2rust/lib.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <iostream>
#include <string_view>

extern "C" void cpp_function(char const *name) {
std::string_view const name_sv = name;
std::cout << "Hello, " << name_sv << "! I'm C++!\n";
std::cout << "Hello, " << "my name is lib.cpp" << "! I'm C++!\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::cout << "Hello, " << "my name is lib.cpp" << "! I'm C++!\n";
std::cout << "Hello, " << name << "! I'm C++!\n";

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops :-)
I'll change that. Sorry.

What do you prefer ?
A 2nd commit or a squash ?

}
4 changes: 1 addition & 3 deletions test/cpp2rust/lib2.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <iostream>
#include <string_view>

extern "C" void cpp_function2(char const *name) {
std::string_view const name_sv = name;
std::cout << "Hello, " << name_sv << "! I'm C++ library Number 2!\n";
std::cout << "Hello, " << "my name is lib2.cpp" << "! I'm C++ library Number 2!\n";
}

4 changes: 1 addition & 3 deletions test/cpp2rust/path with space/lib3.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Check that libraries located at a path containing a space can also be linked.

#include <iostream>
#include <string_view>

extern "C" void cpp_function3(char const *name) {
std::string_view const name_sv = name;
std::cout << "Hello, " << name_sv << "! I'm C++ library Number 3!\n";
std::cout << "Hello, " << "my name is lib3.cpp" << "! I'm C++ library Number 3!\n";
}