-
Notifications
You must be signed in to change notification settings - Fork 199
/
Copy pathcodegen.rs
82 lines (80 loc) · 2.95 KB
/
codegen.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// TODO: Implement tests similar to the other generators.
// This requires that we have any dependencies either included here or published to NuGet or similar.
use std::path::Path;
use wit_component::StringEncoding;
macro_rules! codegen_test {
($id:ident $name:tt $test:tt) => {
#[test]
fn $id() {
test_helpers::run_world_codegen_test(
"guest-csharp",
$test.as_ref(),
|resolve, world, files| {
if [
"conventions",
"flags",
"guest-name",
"import-and-export-resource",
"import-and-export-resource-alias",
"import-func",
"integers",
"issue544",
"issue551",
"issue569",
"issue573",
"issue607",
"issue668",
"just-export",
"keywords",
"lift-lower-foreign",
"lists",
"many-arguments",
"multi-return",
"option-result",
"records",
"rename-interface",
"resource-alias",
"resource-borrow-in-record",
"resource-borrow-in-record-export",
"resource-local-alias",
"resource-local-alias-borrow",
"resource-local-alias-borrow-import",
"resource-own-in-other-interface",
"resources",
"resources-in-aggregates",
"resources-with-lists",
"result-empty",
"ret-areas",
"return-resource-from-export",
"same-names5",
"simple-functions",
"simple-http",
"simple-lists",
"small-anonymous",
"unused-import",
"use-across-interfaces",
"variants",
"worlds-with-types",
"zero-size-tuple",
]
.contains(&$name)
{
return;
}
wit_bindgen_csharp::Opts {
generate_stub: true,
string_encoding: StringEncoding::UTF8,
}
.build()
.generate(resolve, world, files)
.unwrap()
},
verify,
)
}
};
}
test_helpers::codegen_tests!();
fn verify(_dir: &Path, _name: &str) {
// TODO?
}