summary refs log tree commit diff stats
path: root/tests/stdlib/tjsonmacro_reject2.nim
blob: e13dad3078eebd4285b09b3824809146556ff807 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
discard """
  errormsg: "The `to` macro does not support ref objects with cycles."
  file: "tjsonmacro_reject2.nim"
  line: 10
"""
import json

type
  Misdirection = object
    cycle: Cycle

  Cycle = ref object
    foo: string
    cycle: Misdirection

let data = """
  {"cycle": null}
"""

let dataParsed = parseJson(data)
let dataDeser = to(dataParsed, Cycle)