summary refs log tree commit diff stats
path: root/tests/lexer/tident.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lexer/tident.nim')
-rw-r--r--tests/lexer/tident.nim34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/lexer/tident.nim b/tests/lexer/tident.nim
new file mode 100644
index 000000000..e5177436d
--- /dev/null
+++ b/tests/lexer/tident.nim
@@ -0,0 +1,34 @@
+discard """
+output: '''
+Length correct
+Correct
+Correct
+Correct
+Correct
+Correct
+Correct
+Correct
+Correct
+'''
+"""
+
+type
+  TIdObj* = object of RootObj
+    id*: int                  # unique id; use this for comparisons and not the pointers
+
+  PIdObj* = ref TIdObj
+  PIdent* = ref TIdent
+  TIdent*{.acyclic.} = object
+    s*: string
+
+proc myNewString(L: int): string {.inline.} =
+  result = newString(L)
+  if result.len == L: echo("Length correct")
+  else: echo("bug")
+  for i in 0..L-1:
+    if result[i] == '\0':
+      echo("Correct")
+    else:
+      echo("Wrong")
+
+var s = myNewString(8)