summary refs log tree commit diff stats
path: root/tests/concepts/tmatrixlib.nim
Commit message (Expand)AuthorAgeFilesLines
* Working test cases for the sophisticated matrix library example from the manualZahary Karadjov2017-03-241-0/+31
rr { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Specia
discard """
  cmd: '''nim c --newruntime $file'''
  output: '''no crash'''
"""

# bug #11205

type
  MyEnum = enum
    A, B, C
  MyCaseObject = object
    case kind: MyEnum
    of A: iseq: seq[int]
    of B: fseq: seq[float]
    of C: str: string


  MyCaseObjectB = object # carefully constructed to use the same enum,
                         # but a different object type!
    case kind: MyEnum
    of A, C: x: int
    of B: fseq: seq[float]


var x = MyCaseObject(kind: A)
x.iseq.add 1
#x.kind = B
#x.fseq.add -3.0

var y = MyCaseObjectB(kind: A)
y.x = 1
y.kind = C
echo "no crash"