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