'see' on tuple classes didn't show initial values if slot type was not declared

db4
Slava Pestov 2009-06-14 17:46:29 -05:00
parent 6fb7dca404
commit 425f1f96c5
2 changed files with 55 additions and 2 deletions

View File

@ -303,3 +303,54 @@ M: started-out-hustlin' ended-up-ballin' ; inline
[ "USING: prettyprint.tests ;\nM: started-out-hustlin' ended-up-ballin' ; inline\n" ] [ [ "USING: prettyprint.tests ;\nM: started-out-hustlin' ended-up-ballin' ; inline\n" ] [
[ M\ started-out-hustlin' ended-up-ballin' see ] with-string-writer [ M\ started-out-hustlin' ended-up-ballin' see ] with-string-writer
] unit-test ] unit-test
TUPLE: tuple-with-declared-slot { x integer } ;
[
{
"USING: math ;"
"IN: prettyprint.tests"
"TUPLE: tuple-with-declared-slot { x integer initial: 0 } ;"
""
}
] [
[ \ tuple-with-declared-slot see ] with-string-writer "\n" split
] unit-test
TUPLE: tuple-with-read-only-slot { x read-only } ;
[
{
"IN: prettyprint.tests"
"TUPLE: tuple-with-read-only-slot { x read-only } ;"
""
}
] [
[ \ tuple-with-read-only-slot see ] with-string-writer "\n" split
] unit-test
TUPLE: tuple-with-initial-slot { x initial: 123 } ;
[
{
"IN: prettyprint.tests"
"TUPLE: tuple-with-initial-slot { x initial: 123 } ;"
""
}
] [
[ \ tuple-with-initial-slot see ] with-string-writer "\n" split
] unit-test
TUPLE: tuple-with-initial-declared-slot { x integer initial: 123 } ;
[
{
"USING: math ;"
"IN: prettyprint.tests"
"TUPLE: tuple-with-initial-declared-slot"
" { x integer initial: 123 } ;"
""
}
] [
[ \ tuple-with-initial-declared-slot see ] with-string-writer "\n" split
] unit-test

View File

@ -165,12 +165,14 @@ M: array pprint-slot-name
dup name>> , dup name>> ,
dup class>> object eq? [ dup class>> object eq? [
dup class>> , dup class>> ,
initial: ,
dup initial>> ,
] unless ] unless
dup read-only>> [ dup read-only>> [
read-only , read-only ,
] when ] when
dup [ class>> object eq? not ] [ initial>> ] bi or [
initial: ,
dup initial>> ,
] when
drop drop
] { } make ; ] { } make ;