1package local:local; 2 3interface baz { 4 foo: async func(s: string) -> string; 5} 6 7world round-trip { 8 import baz; 9 export baz; 10} 11 12interface many { 13 record stuff { 14 a: list<s32>, 15 b: bool, 16 c: u64 17 } 18 19 foo: async func(a: string, 20 b: u32, 21 c: list<u8>, 22 d: tuple<u64, u64>, 23 e: stuff, 24 f: option<stuff>, 25 g: result<stuff>) 26 -> tuple<string, 27 u32, 28 list<u8>, 29 tuple<u64, u64>, 30 stuff, 31 option<stuff>, 32 result<stuff>>; 33} 34 35world round-trip-many { 36 import many; 37 export many; 38} 39 40world round-trip-direct { 41 import foo: async func(s: string) -> string; 42 export foo: async func(s: string) -> string; 43} 44 45interface ready { 46 resource thing { 47 constructor(); 48 set-ready: func(ready: bool); 49 when-ready: async func(); 50 } 51} 52 53interface continue { 54 set-continue: func(continue: bool); 55 get-continue: func() -> bool; 56} 57 58interface run { 59 run: async func(); 60} 61 62interface backpressure { 63 set-backpressure: func(enabled: bool); 64 inc-backpressure: func(); 65 dec-backpressure: func(); 66} 67 68interface transmit { 69 variant control { 70 read-stream(string), 71 read-stream-zero, 72 read-future(string), 73 write-stream(string), 74 write-stream-zero, 75 write-future(string), 76 } 77 78 exchange: async func(control: stream<control>, 79 caller-stream: stream<string>, 80 caller-future1: future<string>, 81 caller-future2: future<string>) -> tuple<stream<string>, future<string>, future<string>>; 82} 83 84interface post-return { 85 foo: async func(s: string) -> string; 86 get-post-return-value: func() -> string; 87} 88 89interface borrowing-types { 90 resource x { 91 constructor(); 92 foo: func(); 93 } 94} 95 96interface borrowing { 97 use borrowing-types.{x}; 98 99 foo: async func(x: borrow<x>, misbehave: bool); 100} 101 102interface run-bool { 103 run: async func(v: bool); 104} 105 106interface run-result { 107 run-fail: async func() -> result<_, error-context>; 108 run-pass: async func() -> result<_, error-context>; 109} 110 111interface run-stream { 112 produce-then-error: func(times: u32) -> stream; 113} 114 115interface run-future { 116 produce-then-error: func() -> future; 117} 118 119interface unit-stream { 120 run: async func(count: u32) -> stream; 121} 122 123interface resource-stream { 124 resource x { 125 foo: func(); 126 } 127 128 foo: async func(count: u32) -> stream<x>; 129} 130 131interface closed { 132 read-stream: async func(rx: stream<u8>, expected: list<u8>); 133 read-future: async func(rx: future<u8>, expected: u8, rx-ignore: future<u8>); 134 read-future-post-return: async func(rx: future<u8>, expected: u8, rx-ignore: future<u8>); 135} 136 137interface yield { 138 yield-times: async func(times: u64); 139} 140 141interface yield-with-options { 142 use cancel.{mode}; 143 144 variant on-cancel { 145 task-return, 146 task-cancel 147 } 148 149 yield-times: async func(times: u64, on-cancel: on-cancel, on-cancel-delay-times: u64, synchronous-delay: bool, mode: mode); 150} 151 152interface cancel { 153 variant mode { 154 normal, 155 trap-cancel-guest-after-start-cancelled, 156 trap-cancel-guest-after-return-cancelled, 157 trap-cancel-guest-after-return, 158 trap-cancel-host-after-return-cancelled, 159 trap-cancel-host-after-return, 160 leak-task-after-cancel, 161 } 162 163 run: async func(mode: mode, cancel-delay-times: u64); 164} 165 166interface intertask { 167 foo: func(fut: future); 168} 169 170interface readiness { 171 start: async func(s: stream<u8>, expected: list<u8>) -> tuple<stream<u8>, list<u8>>; 172} 173 174interface synchronous-transmit { 175 start: async func(s: stream<u8>, s-expected: list<u8>, f: future<u8>, f-expected: u8) -> tuple<stream<u8>, list<u8>, future<u8>, u8>; 176} 177 178interface yield-post-return { 179 run: async func(times: u64); 180} 181 182interface closed-stream { 183 get: func() -> stream<u8>; 184} 185 186interface short-reads { 187 resource thing { 188 constructor(s: string); 189 get: async func() -> string; 190 } 191 192 short-reads: async func(s: stream<thing>) -> stream<thing>; 193} 194 195world yield-caller { 196 import continue; 197 import ready; 198 import run; 199 export run; 200} 201 202world yield-callee { 203 import continue; 204 export run; 205} 206 207world yield-runner { 208 import continue; 209 import ready; 210 export run; 211} 212 213world poll { 214 import ready; 215 export run; 216} 217 218world backpressure-caller { 219 import backpressure; 220 import run; 221 export run; 222} 223 224world backpressure-callee { 225 export backpressure; 226 export run; 227} 228 229world transmit-caller { 230 import transmit; 231 export run; 232} 233 234world transmit-callee { 235 export transmit; 236} 237 238world post-return-caller { 239 import post-return; 240 export run; 241} 242 243world post-return-callee { 244 export post-return; 245} 246 247world borrowing-caller { 248 import borrowing; 249 export run-bool; 250} 251 252world borrowing-callee { 253 export borrowing; 254 export run-bool; 255} 256 257world borrowing-host { 258 import borrowing-types; 259 export run-bool; 260} 261 262world error-context-usage { 263 export run; 264} 265 266world error-context-callee { 267 export run-result; 268 export run; 269} 270 271world error-context-caller { 272 import run-result; 273 export run; 274} 275 276world error-context-stream-callee { 277 export run-stream; 278 export run; 279} 280 281world error-context-stream-caller { 282 import run-stream; 283 export run; 284} 285 286world error-context-future-callee { 287 export run-future; 288 export run; 289} 290 291world error-context-future-caller { 292 import run-future; 293 export run; 294} 295 296world unit-stream-caller { 297 import unit-stream; 298 export run; 299} 300 301world unit-stream-callee { 302 export unit-stream; 303} 304 305world read-resource-stream { 306 import resource-stream; 307 export run; 308} 309 310world closed-streams { 311 export closed; 312} 313 314world yield-host { 315 import yield; 316} 317 318world cancel-caller { 319 import backpressure; 320 import yield; 321 import yield-with-options; 322 export cancel; 323} 324 325world cancel-callee { 326 import yield; 327 export backpressure; 328 export yield; 329 export yield-with-options; 330} 331 332world cancel-host { 333 export cancel; 334} 335 336world intertask-communication { 337 import intertask; 338 export run; 339} 340 341world readiness-guest { 342 export readiness; 343} 344 345world synchronous-transmit-guest { 346 export synchronous-transmit; 347} 348 349world yield-post-return-callee { 350 import yield; 351 export yield-post-return; 352} 353 354world yield-post-return-caller { 355 import yield; 356 import yield-post-return; 357 export yield-post-return; 358} 359 360world closed-stream-guest { 361 export closed-stream; 362} 363 364world short-reads-guest { 365 export short-reads; 366} 367