Skip to content

Commit

Permalink
use default none
Browse files Browse the repository at this point in the history
  • Loading branch information
mcanlas committed Mar 25, 2024
1 parent c2fdc17 commit f9f32a8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ object DemoDsl:
1,
Link.Weight.Normal,
Link.Direction.Single(Link.Head.Arrow),
text = None,
NonEmptyList.one(dest),
style = None
NonEmptyList.one(dest)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@ object FlowchartDsl:
length: Int,
weight: Weight,
direction: Direction,
text: Option[String],
destinations: NonEmptyList[String],
style: Option[StyleSpec]
text: Option[String] = None,
style: Option[StyleSpec] = None
)
case Invisible(length: Int, destinations: NonEmptyList[String], style: Option[StyleSpec])
case Invisible(length: Int, destinations: NonEmptyList[String], style: Option[StyleSpec] = None)

enum Weight:
case Normal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object LinkEncoder:
ampersand(destinations)
) -> style

case Segment.Visible(length, weight, direction, oText, destinations, style) =>
case Segment.Visible(length, weight, direction, destinations, oText, style) =>
val (leftHead, rightHead) =
(weight, direction) match
case (Weight.Normal, Direction.Open) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,19 +293,15 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Normal,
Link.Direction.Open,
text = None,
NonEmptyList.one("beta"),
style = None
NonEmptyList.one("beta")
),
Link
.Segment
.Visible(
2,
Link.Weight.Normal,
Link.Direction.Open,
text = None,
NonEmptyList.one("gamma"),
style = None
NonEmptyList.one("gamma")
)
)
)
Expand All @@ -331,9 +327,7 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Normal,
Link.Direction.Single(Link.Head.Arrow),
text = None,
NonEmptyList.one("bar"),
style = None
NonEmptyList.one("bar")
)
)
)
Expand All @@ -359,9 +353,7 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Normal,
Link.Direction.Multi(Link.Head.Arrow),
text = None,
NonEmptyList.one("bar"),
style = None
NonEmptyList.one("bar")
)
)
)
Expand All @@ -387,9 +379,8 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Normal,
Link.Direction.Open,
text = Some("hello"),
NonEmptyList.one("bar"),
style = None
text = Some("hello")
)
)
)
Expand All @@ -413,15 +404,13 @@ object FlowchartSuite extends FunSuite:
.Segment
.Invisible(
1,
NonEmptyList.one("bar"),
style = None
NonEmptyList.one("bar")
),
Link
.Segment
.Invisible(
2,
NonEmptyList.one("baz"),
style = None
NonEmptyList.one("baz")
)
)
)
Expand All @@ -447,19 +436,15 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Dotted,
Link.Direction.Open,
text = None,
NonEmptyList.one("two"),
style = None
NonEmptyList.one("two")
),
Link
.Segment
.Visible(
2,
Link.Weight.Dotted,
Link.Direction.Open,
text = None,
NonEmptyList.one("three"),
style = None
NonEmptyList.one("three")
)
)
)
Expand All @@ -485,19 +470,17 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Dotted,
Link.Direction.Open,
text = Some("foo"),
NonEmptyList.one("two"),
style = None
text = Some("foo")
),
Link
.Segment
.Visible(
2,
Link.Weight.Dotted,
Link.Direction.Open,
text = Some("bar"),
NonEmptyList.one("three"),
style = None
text = Some("bar")
)
)
)
Expand All @@ -524,8 +507,8 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Normal,
Link.Direction.Single(Link.Head.Arrow),
text = Some("this has style"),
NonEmptyList.one("two"),
text = Some("this has style"),
style = NonEmptyList
.of(
StyleDeclaration("stroke", "#ff3"),
Expand Down Expand Up @@ -561,18 +544,17 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Normal,
Link.Direction.Single(Link.Head.Arrow),
text = Some("foo"),
NonEmptyList.one("two"),
style = None
text = Some("foo")
),
Link
.Segment
.Visible(
2,
Link.Weight.Normal,
Link.Direction.Single(Link.Head.Arrow),
text = Some("bar"),
NonEmptyList.one("three"),
text = Some("bar"),
style = NonEmptyList
.of(
StyleDeclaration("stroke", "#3ff"),
Expand Down Expand Up @@ -610,19 +592,17 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Normal,
Link.Direction.Single(Link.Head.Arrow),
text = Some("foo"),
NonEmptyList.one("two"),
style = None
text = Some("foo")
),
Link
.Segment
.Visible(
2,
Link.Weight.Normal,
Link.Direction.Single(Link.Head.Arrow),
text = Some("bar"),
NonEmptyList.one("three"),
style = None
text = Some("bar")
)
)
),
Expand All @@ -635,8 +615,8 @@ object FlowchartSuite extends FunSuite:
1,
Link.Weight.Normal,
Link.Direction.Single(Link.Head.Arrow),
text = None,
NonEmptyList.one("styledEnd"),
text = None,
style = NonEmptyList
.of(
StyleDeclaration("stroke", "#3ff"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ object PrintCurveStyles extends IOApp.Simple:
2,
FlowchartDsl.Link.Weight.Normal,
FlowchartDsl.Link.Direction.Single(Head.Arrow),
text = None,
NonEmptyList.one("destinationA"),
None
NonEmptyList.one("destinationA")
)
)
),
Expand All @@ -69,9 +67,7 @@ object PrintCurveStyles extends IOApp.Simple:
2,
FlowchartDsl.Link.Weight.Normal,
FlowchartDsl.Link.Direction.Single(Head.Arrow),
text = None,
NonEmptyList.one("destinationB"),
None
NonEmptyList.one("destinationB")
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ object StyleSuite extends FunSuite:
1,
Link.Weight.Normal,
Link.Direction.Single(Link.Head.Arrow),
text = None,
NonEmptyList.one("id2"),
style = None
NonEmptyList.one("id2")
)
)
)
Expand Down

0 comments on commit f9f32a8

Please sign in to comment.