File tree Expand file tree Collapse file tree 13 files changed +94
-159
lines changed Expand file tree Collapse file tree 13 files changed +94
-159
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -325,9 +325,12 @@ impl Runner<'_> {
325
325
dir : & Path ,
326
326
) -> Result < ( config:: WitConfig , Vec < Component > ) > {
327
327
let mut resolve = wit_parser:: Resolve :: default ( ) ;
328
- let pkg = resolve
329
- . push_file ( & wit)
330
- . context ( "failed to load `test.wit` in test directory" ) ?;
328
+
329
+ let wit_path = if dir. join ( "deps" ) . exists ( ) { dir } else { wit } ;
330
+ let ( pkg, _files) = resolve. push_path ( wit_path) . context ( format ! (
331
+ "failed to load `test.wit` in test directory: {:?}" ,
332
+ & wit
333
+ ) ) ?;
331
334
let resolve = Arc :: new ( resolve) ;
332
335
333
336
let wit_contents = std:: fs:: read_to_string ( wit) ?;
@@ -378,7 +381,7 @@ impl Runner<'_> {
378
381
args : Vec :: new ( ) ,
379
382
wit_config : wit_config. clone ( ) ,
380
383
world : resolve. worlds [ * world] . name . clone ( ) ,
381
- wit_path : wit . to_path_buf ( ) ,
384
+ wit_path : wit_path . to_path_buf ( ) ,
382
385
} ;
383
386
let component = self
384
387
. parse_component ( & path, * kind, bindgen)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Runtime . InteropServices ;
3
+ using System . Diagnostics ;
4
+ using v1 = RunnerWorld . wit . imports . test . dep . v0_1_0 ;
5
+ using v2 = RunnerWorld . wit . imports . test . dep . v0_2_0 ;
6
+ using System . Text ;
7
+
8
+ public class Program
9
+ {
10
+ public static void Main ( string [ ] args ) {
11
+ Debug . Assert ( v1 . TestInterop . X ( ) == 1.0f ) ;
12
+ Debug . Assert ( v1 . TestInterop . Y ( 1.0f ) == 2.0f ) ;
13
+
14
+ Debug . Assert ( v2 . TestInterop . X ( ) == 2.0f ) ;
15
+ Debug . Assert ( v2 . TestInterop . Z ( 1.0f , 1.0f ) == 4.0f ) ;
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ include ! ( env!( "BINDINGS" ) ) ;
2
+
3
+ fn main ( ) {
4
+ use test:: dep0_1_0:: test as v1;
5
+ assert_eq ! ( v1:: x( ) , 1.0 ) ;
6
+ assert_eq ! ( v1:: y( 1.0 ) , 2.0 ) ;
7
+
8
+ use test:: dep0_2_0:: test as v2;
9
+ assert_eq ! ( v2:: x( ) , 2.0 ) ;
10
+ assert_eq ! ( v2:: z( 1.0 , 1.0 ) , 4.0 ) ;
11
+ }
Original file line number Diff line number Diff line change
1
+ using System . Diagnostics ;
2
+
3
+ namespace TestWorld . wit . exports . test . dep . v0_1_0 {
4
+ public class TestImpl : TestWorld . wit . exports . test . dep . v0_1_0 . ITest
5
+ {
6
+ public static float X ( ) {
7
+ return 1.0f ;
8
+ }
9
+
10
+ public static float Y ( float a ) {
11
+ return a + 1.0f ;
12
+ }
13
+ }
14
+ }
15
+
16
+ namespace TestWorld . wit . exports . test . dep . v0_2_0
17
+ {
18
+ public class TestImpl : TestWorld . wit . exports . test . dep . v0_2_0 . ITest
19
+ {
20
+ public static float X ( ) {
21
+ return 2.0f ;
22
+ }
23
+
24
+ public static float Z ( float a , float b ) {
25
+ return a + b + 2.0f ;
26
+ }
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ include ! ( env!( "BINDINGS" ) ) ;
2
+
3
+ use exports:: test:: dep0_1_0:: test:: Guest as v1;
4
+ use exports:: test:: dep0_2_0:: test:: Guest as v2;
5
+
6
+ struct Component ;
7
+
8
+ export ! ( Component ) ;
9
+
10
+ impl v1 for Component {
11
+ fn x ( ) -> f32 {
12
+ 1.0
13
+ }
14
+
15
+ fn y ( a : f32 ) -> f32 {
16
+ 1.0 + a
17
+ }
18
+ }
19
+
20
+ impl v2 for Component {
21
+ fn x ( ) -> f32 {
22
+ 2.0
23
+ }
24
+
25
+ fn z ( a : f32 , b : f32 ) -> f32 {
26
+ 2.0 + a + b
27
+ }
28
+ }
Original file line number Diff line number Diff line change 1
1
package test : versions ;
2
2
3
- world foo {
3
+ world runner {
4
4
import test :dep /test @ 0.1.0 ;
5
5
import test :dep /test @ 0.2.0 ;
6
+ }
6
7
8
+ world test {
7
9
export test :dep /test @ 0.1.0 ;
8
10
export test :dep /test @ 0.2.0 ;
9
- export test-imports : func ();
10
11
}
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ mod resource_into_inner;
27
27
mod resource_with_lists;
28
28
mod resources;
29
29
mod results;
30
- mod versions;
31
30
32
31
struct MyCtx { }
33
32
You can’t perform that action at this time.
0 commit comments