()
| 94 | |
| 95 | #[test] |
| 96 | fn allows_shorthand_struct_literals() { |
| 97 | let source = r#" |
| 98 | divide: (a: i32, b: i32) -> { quotient: i32, remainder: i32 } { |
| 99 | return { .quotient = a / b, .remainder = a % b } |
| 100 | } |
| 101 | |
| 102 | main: () -> i32 { |
| 103 | { quotient: i32, remainder: i32 } = divide(10, 3) |
| 104 | return quotient + remainder |
| 105 | } |
| 106 | "#; |
| 107 | |
| 108 | let mut pipeline = CompilationPipeline::new(); |
| 109 | pipeline.set_write_artifacts(false); |
| 110 | let result = pipeline.compile(source); |
| 111 | assert!( |
| 112 | result.is_ok(), |
| 113 | "expected shorthand struct literals to compile successfully: {:?}", |
| 114 | result.err() |
| 115 | ); |
| 116 | } |
| 117 | |
| 118 | #[test] |
| 119 | fn allows_struct_destructuring_from_type_alias() { |
nothing calls this directly
no test coverage detected