summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-03-29 07:40:37 +0800
committerGitHub <noreply@github.com>2021-03-29 01:40:37 +0200
commita5600e49df71463cda6bd0a062e02c8bdd48da0c (patch)
tree52a53265ff12c8bd3198400d9303123bcddea3b6
parent207bcabdf29dbaa954a3db778cbd9e4d59ca37ae (diff)
downloadNim-a5600e49df71463cda6bd0a062e02c8bdd48da0c.tar.gz
close #9622 add testcase (#17557)
* fix nim js cmp fails at CT

* close #9622 add testcase
-rw-r--r--tests/vm/t9622.nim30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/vm/t9622.nim b/tests/vm/t9622.nim
new file mode 100644
index 000000000..214ab0f19
--- /dev/null
+++ b/tests/vm/t9622.nim
@@ -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: "")])]"""