diff options
Diffstat (limited to 'tests/lexer/tident.nim')
-rw-r--r-- | tests/lexer/tident.nim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lexer/tident.nim b/tests/lexer/tident.nim new file mode 100644 index 000000000..1ed9894c6 --- /dev/null +++ b/tests/lexer/tident.nim @@ -0,0 +1,22 @@ + +type + TIdObj* = object of TObject + 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) + |