We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a40cd7e commit 4899985Copy full SHA for 4899985
tests/test_objects.nim
@@ -7,14 +7,15 @@ block:
7
var v = s.fromJson(Entry1)
8
doAssert v.color == ""
9
10
-block:
11
- type Frog = object
12
- legs: int = 4
+when NimMajor >= 2: # Default field values are only supported in Nim 2.0+
+ block:
+ type Frog = object
13
+ legs: int = 4
14
- var s = "{}"
15
- var f = s.fromJson(Frog)
16
- # Make sure the default value is deserialized correctly.
17
- doAssert f.legs == 4
+ var s = "{}"
+ var f = s.fromJson(Frog)
+ # Make sure the default value is deserialized correctly.
18
+ doAssert f.legs == 4
19
20
block:
21
type Foo2 = ref object
0 commit comments