summary refs log tree commit diff stats
path: root/tests/fields
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-20 19:39:49 +0100
committerAraq <rumpf_a@web.de>2015-02-20 20:01:25 +0100
commit77406dd59c6e3afc66903227d50ae3b54d4a7540 (patch)
treedc3788d52a9a81c3d3079a9a3a1609fb16ab1ef5 /tests/fields
parentaef7be2e79831f4cdbd3292a7c5060e403bbff5e (diff)
downloadNim-77406dd59c6e3afc66903227d50ae3b54d4a7540.tar.gz
fixes #2134
Diffstat (limited to 'tests/fields')
-rw-r--r--tests/fields/tfields_with_break.nim33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/fields/tfields_with_break.nim b/tests/fields/tfields_with_break.nim
new file mode 100644
index 000000000..1f2632692
--- /dev/null
+++ b/tests/fields/tfields_with_break.nim
@@ -0,0 +1,33 @@
+discard """
+  output: '''(one: 1, two: 2, three: 3)
+1
+2
+3
+(one: 4, two: 5, three: 6)
+4
+(one: 7, two: 8, three: 9)
+7
+8
+9'''
+"""
+
+# bug #2134
+type
+    TestType = object
+        one: int
+        two: int
+        three: int
+
+var
+    ab = TestType(one:1, two:2, three:3)
+    ac = TestType(one:4, two:5, three:6)
+    ad = TestType(one:7, two:8, three:9)
+    tstSeq = [ab, ac, ad]
+
+for tstElement in mitems(tstSeq):
+    echo tstElement
+    for tstField in fields(tstElement):
+        #for tstField in [1,2,4,6]:
+        echo tstField
+        if tstField == 4:
+            break