Skip to content

Commit 040a771

Browse files
authored
Migrate resource_alias test to wit-bindgen test (#1258)
Relatively simple conversion
1 parent 80f46dd commit 040a771

File tree

8 files changed

+23
-87
lines changed

8 files changed

+23
-87
lines changed

crates/test-rust-wasm/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,3 @@ test = false
3838
[[bin]]
3939
name = "resource_with_lists"
4040
test = false
41-
42-
[[bin]]
43-
name = "resource_alias"
44-
test = false

crates/test-rust-wasm/src/bin/resource_alias.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
include!(env!("BINDINGS"));
2+
3+
use test::resource_alias::e1::{a as a1, Foo as Foo1, X};
4+
use test::resource_alias::e2::{a as a2, Foo as Foo2};
5+
6+
fn main() {
7+
let foo_e1 = Foo1 { x: X::new(42) };
8+
a1(foo_e1);
9+
10+
let foo_e2 = Foo2 { x: X::new(7) };
11+
let bar_e2 = Foo1 { x: X::new(8) };
12+
let y = X::new(8);
13+
a2(foo_e2, bar_e2, &y);
14+
}

tests/runtime/resource_alias/wasm.cs renamed to tests/runtime-new/resource_alias/test.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace ResourceAliasWorld.wit.exports.test.resourceAlias
1+
namespace TestWorld.wit.exports.test.resourceAlias
22
{
33
public class E1Impl : IE1 {
44
public class X : IE1.X, IE1.IX {
@@ -13,7 +13,7 @@ public X(uint v) {
1313
return new List<IE1.X>() { f.x };
1414
}
1515
}
16-
16+
1717
public class E2Impl : IE2 {
1818
public static List<IE1.X> A(IE2.Foo f, IE1.Foo g, IE1.X h) {
1919
return new List<IE1.X>() { f.x, g.x };

tests/runtime/resource_alias/wasm.rs renamed to tests/runtime-new/resource_alias/test.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
wit_bindgen::generate!({
2-
path: "../../tests/runtime/resource_alias",
3-
});
1+
include!(env!("BINDINGS"));
42

53
pub struct Test {}
64

tests/runtime/resource_alias/world.wit renamed to tests/runtime-new/resource_alias/test.wit

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ interface e2 {
1818
a: func(f: foo, g: bar, h: borrow<y>) -> list<y>;
1919
}
2020

21-
world resource-alias {
21+
world test {
2222
export e1;
2323
export e2;
2424
}
25+
26+
world runner {
27+
import e1;
28+
import e2;
29+
}

tests/runtime/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use wit_parser::{Resolve, WorldId, WorldItem};
1515

1616
mod flavorful;
1717
mod options;
18-
mod resource_alias;
1918
mod resource_floats;
2019
mod resource_import_and_export;
2120
mod resource_with_lists;

tests/runtime/resource_alias.rs

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)