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 {
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
}

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

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

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

Loading…
Cancel
Save