number nodes should display their type in tests

master
Jordan Orelli 10 years ago
parent 36690e10ae
commit 26cff24756

@ -319,7 +319,14 @@ func (n *numberNode) pretty(w io.Writer, prefix string) error {
if err != nil { if err != nil {
return err return err
} }
fmt.Fprintf(w, "%snumber:\n%s%s%v\n", prefix, prefix, indent, v) switch n.t {
case num_int:
fmt.Fprintf(w, "%sint:\n%s%s%v\n", prefix, prefix, indent, v)
case num_float:
fmt.Fprintf(w, "%sfloat:\n%s%s%v\n", prefix, prefix, indent, v)
case num_complex:
fmt.Fprintf(w, "%scomplex:\n%s%s%v\n", prefix, prefix, indent, v)
}
return nil return nil
} }

@ -9,65 +9,65 @@ root:
name: name:
an_int an_int
value: value:
number: int:
1 1
assign: assign:
name: name:
another_int another_int
value: value:
number: int:
9 9
assign: assign:
name: name:
moar_int moar_int
value: value:
number: int:
-12 -12
assign: assign:
name: name:
a_float a_float
value: value:
number: float:
1 1
assign: assign:
name: name:
another_float another_float
value: value:
number: float:
-0.9 -0.9
assign: assign:
name: name:
extra_floaty extra_floaty
value: value:
number: float:
1.2 1.2
assign: assign:
name: name:
complex1 complex1
value: value:
number: complex:
(1+1i) (1+1i)
assign: assign:
name: name:
complex2 complex2
value: value:
number: complex:
(1+0i) (1+0i)
assign: assign:
name: name:
complex3 complex3
value: value:
number: complex:
(1.3+4.7i) (1.3+4.7i)
assign: assign:
name: name:
complex4 complex4
value: value:
number: complex:
(-4.2+8.9i) (-4.2+8.9i)
assign: assign:
name: name:
complex5 complex5
value: value:
number: complex:
(4.2-8.9i) (4.2-8.9i)

@ -4,9 +4,9 @@ root:
items items
value: value:
list: list:
number: int:
1 1
number: int:
2 2
number: int:
3 3

@ -3,31 +3,31 @@ root:
name: name:
root_int root_int
value: value:
number: int:
1 1
assign: assign:
name: name:
root_float root_float
value: value:
number: float:
1.2 1.2
assign: assign:
name: name:
root_exp root_exp
value: value:
number: float:
1e+09 1e+09
assign: assign:
name: name:
root_hex root_hex
value: value:
number: int:
703710 703710
assign: assign:
name: name:
root_oct root_oct
value: value:
number: int:
511 511
assign: assign:
name: name:
@ -48,18 +48,18 @@ root:
string: string:
three three
item_two: item_two:
number: int:
2 2
item_one: item_one:
number: int:
1 1
item_three: item_three:
list: list:
number: int:
1 1
number: int:
2 2
number: int:
3 3
item_two: item_two:
string: string:

Loading…
Cancel
Save