Skip to content

Commit 600d1b7

Browse files
committed
Add extra tests and bump version
1 parent d101e41 commit 600d1b7

File tree

2 files changed

+127
-1
lines changed

2 files changed

+127
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## [Unreleased]
3+
## [8.0.0-alpha-008] - 2026-03-25
44

55
### Added
66

src/Fantomas.Core.Tests/RequiresMultilineToPreserveSemanticsTests.fs

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,3 +413,129 @@ let a =
413413
fun x -> {| X = x |}
414414
<*| op
415415
"""
416+
417+
[<Test>]
418+
let ``constructor with 3 args and no open-ended elements stays on one line`` () =
419+
formatSourceString
420+
"""
421+
Foo.Bar(Title = "hello", Url = "world", Count = 3)
422+
"""
423+
config
424+
|> prepend newline
425+
|> should
426+
equal
427+
"""
428+
Foo.Bar(Title = "hello", Url = "world", Count = 3)
429+
"""
430+
431+
[<Test>]
432+
let ``constructor with 4 args and no open-ended elements stays on one line`` () =
433+
formatSourceString
434+
"""
435+
Foo.Bar(Title = "hello", Url = "world", Count = 3, Extra = "more")
436+
"""
437+
config
438+
|> prepend newline
439+
|> should
440+
equal
441+
"""
442+
Foo.Bar(Title = "hello", Url = "world", Count = 3, Extra = "more")
443+
"""
444+
445+
[<Test>]
446+
let ``constructor with 3 args and if-then-else in first uses comma-leading`` () =
447+
formatSourceString
448+
"""
449+
Foo.Bar(
450+
Title = if true then Some "" else None
451+
, Url = "world"
452+
, Count = 3
453+
)
454+
"""
455+
config
456+
|> prepend newline
457+
|> should
458+
equal
459+
"""
460+
Foo.Bar(
461+
Title = if true then Some "" else None
462+
, Url = "world"
463+
, Count = 3
464+
)
465+
"""
466+
467+
[<Test>]
468+
let ``constructor with 3 args and lambda in middle uses comma-leading`` () =
469+
formatSourceString
470+
"""
471+
Foo.Bar(
472+
Title = "hello"
473+
, Url = fun x -> x
474+
, Count = 3
475+
)
476+
"""
477+
config
478+
|> prepend newline
479+
|> should
480+
equal
481+
"""
482+
Foo.Bar(
483+
Title = "hello"
484+
, Url = fun x -> x
485+
, Count = 3
486+
)
487+
"""
488+
489+
[<Test>]
490+
let ``3-element tuple with lambda in last position stays on one line`` () =
491+
formatSourceString
492+
"""
493+
let x = 1, 2, fun y -> y
494+
"""
495+
config
496+
|> prepend newline
497+
|> should
498+
equal
499+
"""
500+
let x = 1, 2, fun y -> y
501+
"""
502+
503+
[<Test>]
504+
let ``3-element tuple with lambda in first position uses comma-leading`` () =
505+
formatSourceString
506+
"""
507+
let x =
508+
fun y -> y
509+
, 2
510+
, 3
511+
"""
512+
config
513+
|> prepend newline
514+
|> should
515+
equal
516+
"""
517+
let x =
518+
fun y -> y
519+
, 2
520+
, 3
521+
"""
522+
523+
[<Test>]
524+
let ``3-element tuple with lambda in middle uses comma-leading`` () =
525+
formatSourceString
526+
"""
527+
let x =
528+
1
529+
, fun y -> y
530+
, 3
531+
"""
532+
config
533+
|> prepend newline
534+
|> should
535+
equal
536+
"""
537+
let x =
538+
1
539+
, fun y -> y
540+
, 3
541+
"""

0 commit comments

Comments
 (0)