USING: accessors arrays classes.intersection classes.maybe
classes.union compiler.units continuations definitions effects
-eval generic generic.standard io io.streams.duplex
+eval generic generic.standard hashtables io io.streams.duplex
io.streams.string kernel listener make math namespaces parser
prettyprint prettyprint.config prettyprint.private
prettyprint.sections see sequences splitting
-tools.continuations tools.continuations.private tools.test
-vectors vocabs.parser words ;
+strings tools.continuations tools.continuations.private
+tools.test vectors vocabs.parser words ;
IN: prettyprint.tests
[ "4" ] [ 4 unparse ] unit-test
[ "4096" ] [ 4096 unparse ] unit-test
-[ "BIN: 1000000000000" ] [ 2 number-base [ 4096 unparse ] with-variable ] unit-test
-[ "OCT: 10000" ] [ 8 number-base [ 4096 unparse ] with-variable ] unit-test
-[ "HEX: 1000" ] [ 16 number-base [ 4096 unparse ] with-variable ] unit-test
+[ "0b1000000000000" ] [ 2 number-base [ 4096 unparse ] with-variable ] unit-test
+[ "0o10000" ] [ 8 number-base [ 4096 unparse ] with-variable ] unit-test
+[ "0x1000" ] [ 16 number-base [ 4096 unparse ] with-variable ] unit-test
[ "1.0" ] [ 1.0 unparse ] unit-test
[ "8.0" ] [ 8.0 unparse ] unit-test
[ "8.0" ] [ 2 number-base [ 8.0 unparse ] with-variable ] unit-test
[ "8.0" ] [ 8 number-base [ 8.0 unparse ] with-variable ] unit-test
-[ "HEX: 1.0p3" ] [ 16 number-base [ 8.0 unparse ] with-variable ] unit-test
+[ "0x1.0p3" ] [ 16 number-base [ 8.0 unparse ] with-variable ] unit-test
[ "1267650600228229401496703205376" ] [ 1 100 shift unparse ] unit-test
[ "+" ] [ \ + unparse ] unit-test
[ "maybe: bob\n" ] [ [ maybe: bob . ] with-string-writer ] unit-test
[ "maybe: word\n" ] [ [ maybe: word . ] with-string-writer ] unit-test
-
TUPLE: har a ;
GENERIC: harhar ( obj -- obj )
M: maybe: har harhar ;
[ \ harhar see-methods ] with-string-writer
] unit-test
-
TUPLE: mo { a union{ float integer } } ;
TUPLE: fo { a intersection{ fixnum integer } } ;
[
-"""USING: classes.union math ;
+"""USING: math ;
IN: prettyprint.tests
TUPLE: mo { a union{ float integer } initial: 0 } ;
"""
] unit-test
[
-"""USING: classes.intersection math ;
+"""USING: math ;
IN: prettyprint.tests
TUPLE: fo { a intersection{ fixnum integer } initial: 0 } ;
"""
] [
[ \ fo see ] with-string-writer
] unit-test
+
+[
+"""union{
+ union{ float integer }
+ intersection{ string hashtable }
+}
+"""
+] [ [ union{ union{ float integer } intersection{ string hashtable } } . ] with-string-writer ] unit-test
+
+[
+"""intersection{
+ union{ float integer }
+ intersection{ string hashtable }
+}
+"""
+] [ [ intersection{ union{ float integer } intersection{ string hashtable } } . ] with-string-writer ] unit-test
+
+[
+"""maybe: union{ float integer }\n"""
+] [
+ [ maybe: union{ float integer } . ] with-string-writer
+] unit-test
+
+[
+"""maybe: maybe: integer\n"""
+] [
+ [ maybe: maybe: integer . ] with-string-writer
+] unit-test