diff options
author | Dominik Picheta <dominikpicheta@gmail.com> | 2015-10-27 23:36:00 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@gmail.com> | 2015-10-27 23:36:00 +0100 |
commit | 3892969af4a3c6f509b553f07b2a7f37aa8de967 (patch) | |
tree | f4ac158a72b3f520848a479ee4faa8dd68792738 /tests/seq/tseqcon.nim | |
parent | c7eaa8ae034fc22fcb91770f94e08f7c1ebb9963 (diff) | |
parent | d9415fd5cebdc44385cdd092f2c49060c09e2631 (diff) | |
download | Nim-3892969af4a3c6f509b553f07b2a7f37aa8de967.tar.gz |
Merge branch 'devel'
Diffstat (limited to 'tests/seq/tseqcon.nim')
-rw-r--r-- | tests/seq/tseqcon.nim | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/tests/seq/tseqcon.nim b/tests/seq/tseqcon.nim index 6e0a5b56d..902ac3485 100644 --- a/tests/seq/tseqcon.nim +++ b/tests/seq/tseqcon.nim @@ -2,50 +2,50 @@ discard """ file: "tseqcon.nim" output: "Hithere, what\'s your name?Hathere, what\'s your name?" """ -# Test the add proc for sequences and strings - -const - nestedFixed = true - -type - TRec {.final.} = object - x, y: int - s: string - seq: seq[string] - TRecSeq = seq[TRec] - -proc test() = - var s, b: seq[string] - s = @[] - add(s, "Hi") - add(s, "there, ") - add(s, "what's your name?") - - b = s # deep copying here! - b[0][1] = 'a' - - for i in 0 .. len(s)-1: - write(stdout, s[i]) - for i in 0 .. len(b)-1: - write(stdout, b[i]) - - -when nestedFixed: - proc nested() = - var - s: seq[seq[string]] - for i in 0..10_000: # test if the garbage collector - # now works with sequences - s = @[ - @["A", "B", "C", "D"], - @["E", "F", "G", "H"], - @["I", "J", "K", "L"], - @["M", "N", "O", "P"]] - -test() -when nestedFixed: - nested() - -#OUT Hithere, what's your name?Hathere, what's your name? +# Test the add proc for sequences and strings + +const + nestedFixed = true + +type + TRec {.final.} = object + x, y: int + s: string + seq: seq[string] + TRecSeq = seq[TRec] + +proc test() = + var s, b: seq[string] + s = @[] + add(s, "Hi") + add(s, "there, ") + add(s, "what's your name?") + + b = s # deep copying here! + b[0][1] = 'a' + + for i in 0 .. len(s)-1: + write(stdout, s[i]) + for i in 0 .. len(b)-1: + write(stdout, b[i]) + + +when nestedFixed: + proc nested() = + var + s: seq[seq[string]] + for i in 0..10_000: # test if the garbage collector + # now works with sequences + s = @[ + @["A", "B", "C", "D"], + @["E", "F", "G", "H"], + @["I", "J", "K", "L"], + @["M", "N", "O", "P"]] + +test() +when nestedFixed: + nested() + +#OUT Hithere, what's your name?Hathere, what's your name? |