Skip to content

Commit

Permalink
close nim-lang#9622 add testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout committed Mar 28, 2021
1 parent 6f46e62 commit ab3332f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/vm/t9622.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
discard """
targets: "c cpp"
matrix: "--gc:refc; --gc:arc"
"""

type
GlobNodeKind = enum
LiteralIdent,
Group

GlobNode = object
case kind: GlobNodeKind
of LiteralIdent:
value: string
of Group:
values: seq[string]

PathSegment = object
children: seq[GlobNode]

GlobPattern = seq[PathSegment]

proc parseImpl(): GlobPattern =
if result.len == 0:
result.add PathSegment()
result[^1].children.add GlobNode(kind: LiteralIdent)

block:
const pattern = parseImpl()
doAssert $pattern == """@[(children: @[(kind: LiteralIdent, value: "")])]"""

0 comments on commit ab3332f

Please sign in to comment.