Skip to content

Test the C++ generator in CI #1331

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# moonbit removed from language matrix for now - causing CI failures
lang: [c, rust, csharp]
lang: [c, rust, csharp, cpp]
exclude:
# For now csharp doesn't work on macos, so exclude it from testing.
- os: macos-latest
Expand Down
10 changes: 10 additions & 0 deletions crates/test/src/cpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ impl LanguageMethods for Cpp {
}

fn verify(&self, runner: &crate::Runner<'_>, verify: &crate::Verify) -> anyhow::Result<()> {
// for expected
let cwd = std::env::current_dir()?;
let mut helper_dir2 = cwd;
helper_dir2.push("crates");
helper_dir2.push("cpp");
helper_dir2.push("test_headers");

let compiler = clangpp(runner);
let mut cmd = Command::new(compiler);
cmd.arg(
Expand All @@ -186,11 +193,14 @@ impl LanguageMethods for Cpp {
)
.arg("-I")
.arg(&verify.bindings_dir)
.arg("-I")
.arg(helper_dir2.to_str().unwrap().to_string())
.arg("-Wall")
.arg("-Wextra")
.arg("-Werror")
.arg("-Wc++-compat")
.arg("-Wno-unused-parameter")
.arg("-std=c++20")
.arg("-c")
.arg("-o")
.arg(verify.artifacts_dir.join("tmp.o"));
Expand Down
2 changes: 1 addition & 1 deletion tests/runtime/lists/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static bool equal(std::span<const R> const&a, std::vector<R> const& b) {
}
template<class R>
static bool equal(wit::vector<R> const&a, std::vector<R> const& b) {
return equal(a.get_view(), std::span<R>(b));
return equal(a.get_view(), std::span<const R>(b.begin(), b.end()));
}
template<class R,class S, class T, class U>
static bool equal(std::tuple<R,S> const&a, std::tuple<T,U> const& b) {
Expand Down
Loading