Skip to content

Commit 6bafb59

Browse files
committed
restore tests for edition 2015 and 2018
1 parent 2ecd0fa commit 6bafb59

File tree

8 files changed

+67
-1
lines changed

8 files changed

+67
-1
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ members = [
1717
"benchmark",
1818
"capnpc/test",
1919
"capnpc/test/external-crate",
20+
"capnpc/test-edition-2015",
21+
"capnpc/test-edition-2018",
2022
"capnpc/test-edition-2021",
2123
"capnp-futures/test",
2224
"capnp-rpc/examples/hello-world",

capnpc/src/codegen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2624,7 +2624,7 @@ fn generate_node(
26242624
)));
26252625
server_interior.push(
26262626
Line(fmt!(ctx,
2627-
"fn {}(self: {capnp}::capability::Rc<Self>, _: {}Params<{}>, _: {}Results<{}>) -> impl ::core::future::Future<Output = Result<(), {capnp}::Error>> + 'static {{ async {{ Err({capnp}::Error::unimplemented(\"method {}::Server::{} not implemented\".to_string())) }} }}",
2627+
"fn {}(self: {capnp}::capability::Rc<Self>, _: {}Params<{}>, _: {}Results<{}>) -> impl ::core::future::Future<Output = Result<(), {capnp}::Error>> + 'static {{ ::core::future::ready(Err({capnp}::Error::unimplemented(\"method {}::Server::{} not implemented\".to_string()))) }}",
26282628
module_name(name),
26292629
capitalize_first_letter(name), params_ty_params,
26302630
capitalize_first_letter(name), results_ty_params,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
3+
name = "capnpc-test-edition-2015"
4+
version = "0.0.0"
5+
build = "build.rs"
6+
edition = "2015"
7+
8+
[lib]
9+
10+
name = "capnpc_test_edition_2015"
11+
path = "test.rs"
12+
13+
[build-dependencies]
14+
capnpc = { path = "../" }
15+
16+
[dependencies]
17+
capnp = { path = "../../capnp" }
18+
capnpc = { path = "../" }
19+
external-crate = { path = "../test/external-crate" }

capnpc/test-edition-2015/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fn main() {
2+
capnpc::CompilerCommand::new()
3+
.crate_provides("external_crate", [0xe6f94f52f7be8fe2])
4+
.file("../test/test.capnp")
5+
.src_prefix("../test/")
6+
.run()
7+
.expect("compiling schema");
8+
}

capnpc/test-edition-2015/test.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extern crate capnp;
2+
extern crate core;
3+
extern crate external_crate;
4+
5+
pub mod test_capnp {
6+
include!(concat!(env!("OUT_DIR"), "/test_capnp.rs"));
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
3+
name = "capnpc-test-edition-2018"
4+
version = "0.0.0"
5+
build = "build.rs"
6+
edition = "2018"
7+
8+
[lib]
9+
10+
name = "capnpc_test_edition_2018"
11+
path = "test.rs"
12+
13+
[build-dependencies]
14+
capnpc = { path = "../" }
15+
16+
[dependencies]
17+
capnp = { path = "../../capnp" }
18+
capnpc = { path = "../" }
19+
external-crate = { path = "../test/external-crate" }

capnpc/test-edition-2018/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fn main() {
2+
capnpc::CompilerCommand::new()
3+
.crate_provides("external_crate", [0xe6f94f52f7be8fe2])
4+
.file("../test/test.capnp")
5+
.src_prefix("../test/")
6+
.run()
7+
.expect("compiling schema");
8+
}

capnpc/test-edition-2018/test.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod test_capnp {
2+
include!(concat!(env!("OUT_DIR"), "/test_capnp.rs"));
3+
}

0 commit comments

Comments
 (0)