MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / allows_shorthand_struct_literals

Function allows_shorthand_struct_literals

tests/integration/spec_rules.rs:96–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94
95#[test]
96fn allows_shorthand_struct_literals() {
97 let source = r#"
98divide: (a: i32, b: i32) -> { quotient: i32, remainder: i32 } {
99 return { .quotient = a / b, .remainder = a % b }
100}
101
102main: () -> 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]
119fn allows_struct_destructuring_from_type_alias() {

Callers

nothing calls this directly

Calls 2

set_write_artifactsMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected