summary refs log tree commit diff stats
path: root/tests/constr/tconstr2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/constr/tconstr2.nim')
-rw-r--r--tests/constr/tconstr2.nim26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/constr/tconstr2.nim b/tests/constr/tconstr2.nim
new file mode 100644
index 000000000..30cec5cb8
--- /dev/null
+++ b/tests/constr/tconstr2.nim
@@ -0,0 +1,26 @@
+discard """
+  file: "tconstr2.nim"
+  output: "69"
+"""
+# Test array, record constructors

+

+type

+  TComplexRecord = tuple[

+    s: string,

+    x, y: int,

+    z: float,

+    chars: set[char]]

+

+const

+  things: array [0..1, TComplexRecord] = [

+    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),

+    (s: "hi", x: 69, y: 45, z: 1.0, chars: {})] 

+  otherThings = [  # the same

+    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),

+    (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]

+

+write(stdout, things[0].x)

+#OUT 69

+

+
+