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

Configure Feed

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

add tests

parentheses -> curly braces

+62
+62
format/src/tests/bit_array.rs
··· 510 510 "# 511 511 ); 512 512 } 513 + 514 + // https://github.com/gleam-lang/gleam/issues/5606 515 + #[test] 516 + fn dont_insert_curly_braces_with_binary_operators_when_line_is_short() { 517 + assert_format!( 518 + "pub fn main() { 519 + let wubble = <<bits:bits-size(wibble * wobble)-unit(8)>> 520 + } 521 + " 522 + ); 523 + } 524 + 525 + // https://github.com/gleam-lang/gleam/issues/5606 526 + #[test] 527 + fn dont_insert_curly_braces_with_binary_operators_when_line_is_long() { 528 + assert_format_rewrite!( 529 + "pub fn main() { 530 + let some_long_variable_name = <<bits:bits-size(some_other_long_variable_name * and_some_other_long_variable_name)-unit(8)>> 531 + } 532 + ", 533 + "pub fn main() { 534 + let some_long_variable_name = << 535 + bits:bits-size({ 536 + some_other_long_variable_name 537 + * and_some_other_long_variable_name 538 + } 539 + )-unit(8), 540 + >> 541 + } 542 + " 543 + ); 544 + } 545 + 546 + // https://github.com/gleam-lang/gleam/issues/5606 547 + #[test] 548 + fn preserve_user_inserted_curly_braces_with_binary_operators_when_line_is_short() { 549 + assert_format!( 550 + "pub fn main() { 551 + let some_variable = <<bits:bits-size({ some * other })>> 552 + } 553 + " 554 + ); 555 + } 556 + 557 + // https://github.com/gleam-lang/gleam/issues/5606 558 + #[test] 559 + fn preserve_user_inserted_curly_braces_with_binary_operators_when_line_is_long() { 560 + assert_format_rewrite!( 561 + "pub fn main() { 562 + let some_long_variable_name = <<bits:bits-size({ some_other_long_variable_name * and_some_other_long_variable_name })>> 563 + } 564 + ", 565 + "pub fn main() { 566 + let some_long_variable_name = << 567 + bits:bits-size({ 568 + some_other_long_variable_name * and_some_other_long_variable_name 569 + }), 570 + >> 571 + } 572 + " 573 + ); 574 + }