From 3c541f736f3af3b1bc2c4b8b00fec93ca058a457 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Tue, 15 Sep 2009 19:10:05 -0500 Subject: [PATCH] fix failing classes.struct tests --- .../struct/prettyprint/prettyprint.factor | 4 ++-- basis/classes/struct/struct-tests.factor | 23 ++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/basis/classes/struct/prettyprint/prettyprint.factor b/basis/classes/struct/prettyprint/prettyprint.factor index e88834530c..2c969531e8 100644 --- a/basis/classes/struct/prettyprint/prettyprint.factor +++ b/basis/classes/struct/prettyprint/prettyprint.factor @@ -20,7 +20,7 @@ IN: classes.struct.prettyprint > text ] - [ c-type>> dup string? [ text ] [ pprint* ] if ] + [ type>> dup string? [ text ] [ pprint* ] if ] [ read-only>> [ \ read-only pprint-word ] when ] [ initial>> [ \ initial: pprint-word pprint* ] when* ] } cleave block> @@ -111,7 +111,7 @@ M: struct-mirror >alist ( mirror -- alist ) ] [ '[ _ struct>assoc - [ [ [ name>> ] [ c-type>> ] bi 2array ] dip ] assoc-map + [ [ [ name>> ] [ type>> ] bi 2array ] dip ] assoc-map ] [ drop { } ] recover ] bi append ; diff --git a/basis/classes/struct/struct-tests.factor b/basis/classes/struct/struct-tests.factor index 62fce7f353..bbbaf4f1d5 100755 --- a/basis/classes/struct/struct-tests.factor +++ b/basis/classes/struct/struct-tests.factor @@ -5,7 +5,7 @@ combinators compiler.tree.debugger compiler.units destructors io.encodings.utf8 io.pathnames io.streams.string kernel libc literals math mirrors multiline namespaces prettyprint prettyprint.config see sequences specialized-arrays system -tools.test parser lexer eval ; +tools.test parser lexer eval layouts ; SPECIALIZED-ARRAY: char SPECIALIZED-ARRAY: int SPECIALIZED-ARRAY: ushort @@ -199,26 +199,23 @@ UNION-STRUCT: struct-test-float-and-bits T{ struct-slot-spec { name "x" } { offset 0 } + { initial 0 } { class fixnum } { type "char" } - { reader x>> } - { writer (>>x) } } T{ struct-slot-spec { name "y" } { offset 4 } - { class $[ cell 8 = fixnum integer ? ] } + { initial 123 } + { class integer } { type "int" } - { reader y>> } - { writer (>>y) } } T{ struct-slot-spec { name "z" } { offset 8 } + { initial f } { type "bool" } - { class boolean } - { reader z>> } - { writer (>>z) } + { class object } } } ] [ "struct-test-foo" c-type fields>> ] unit-test @@ -228,16 +225,14 @@ UNION-STRUCT: struct-test-float-and-bits { offset 0 } { type "float" } { class float } - { reader f>> } - { writer (>>f) } + { initial 0.0 } } T{ struct-slot-spec { name "bits" } { offset 0 } { type "uint" } - { class $[ cell 8 = fixnum integer ? ] } - { reader bits>> } - { writer (>>bits) } + { class integer } + { initial 0 } } } ] [ "struct-test-float-and-bits" c-type fields>> ] unit-test