Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ArchUnitNET/Fluent/Slices/SliceRuleInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,14 @@ private static SliceIdentifier AssignFunc(
);
}

// An empty prefix means the pattern starts with its capture group; there is no
// namespace to nest the slice under, so report none rather than an empty one.
return fullName
? SliceIdentifier.Of(slicePrefix + sliceString, countOfSingleAsterisk, slicePrefix)
? SliceIdentifier.Of(
slicePrefix + sliceString,
countOfSingleAsterisk,
slicePrefix == "" ? null : slicePrefix
)
: SliceIdentifier.Of(sliceString, countOfSingleAsterisk);
}
}
Expand Down
8 changes: 8 additions & 0 deletions ArchUnitNETTests/Domain/PlantUml/PlantUmlSliceDiagramTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ public Task BuildUmlBySlicesMatchingWithPackages_NonContiguousCaptureGroups()
);
}

[Fact]
public Task BuildUmlBySlicesMatchingWithPackages_CaptureGroupAtStart()
{
// Nothing precedes the capture group, so there is no namespace to nest the slices
// under and they are drawn flat, like those of Matching.
return VerifySlices(SliceRuleDefinition.Slices().MatchingWithPackages("(**).Service"));
}

[Fact]
public Task BuildUmlBySlicesMatchingWithPackages_LimitDependencies()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@startuml

!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

HIDE_STEREOTYPE()

[SlicesTestAssembly.DotDotSemantics.Alpha]
[SlicesTestAssembly.MultipleSubnamespaces.Slice1]
[SlicesTestAssembly.MultipleSubnamespaces.Slice2]
[SlicesTestAssembly.MultipleSubnamespaces.Slice1] --|> [SlicesTestAssembly.MultipleSubnamespaces.Slice2]
@enduml
Loading