Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

gleam / compiler-core / src / format / tests / blocks.rs
1.2 kB 89 lines
1// SPDX-License-Identifier: Apache-2.0 2// SPDX-FileCopyrightText: 2023 The Gleam contributors 3 4use crate::assert_format; 5 6// https://github.com/gleam-lang/gleam/issues/2119 7#[test] 8fn assignment() { 9 assert_format!( 10 r#"fn main() { 11 let greeting = { 12 "Hello" 13 } 14 15 greeting 16} 17"# 18 ); 19} 20 21// https://github.com/gleam-lang/gleam/issues/2131 22#[test] 23fn comment() { 24 assert_format!( 25 r#"fn main() { 26 wibble( 27 // Hello 28 { Nil }, 29 ) 30} 31"# 32 ); 33} 34 35#[test] 36fn block_comment() { 37 assert_format!( 38 r#"fn main() { 39 testbldr.demonstrate( 40 named: "Hello, this argument is longer to make it all wrap", 41 with: { 42 // Comment! 43 Nil 44 Nil 45 }, 46 ) 47} 48"# 49 ); 50} 51 52#[test] 53fn last_comments_are_not_moved_out_of_blocks() { 54 assert_format!( 55 r#"fn main() { 56 { 57 hello 58 // Hope I'm not yeeted out of this block! 59 } 60} 61"# 62 ); 63 64 assert_format!( 65 r#"fn main() { 66 { 67 hello 68 { 69 { hi } 70 // Some nested comments 71 } 72 // At the end of multiple blocks 73 } 74} 75"# 76 ); 77 78 assert_format!( 79 r#"fn main() { 80 case wibble { 81 wobble -> { 82 1 83 // Hope I can stay inside this clause 84 } 85 } 86} 87"# 88 ); 89}