]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/prettyprint/prettyprint-tests.factor
use radix literals
[factor.git] / basis / prettyprint / prettyprint-tests.factor
index 49dcbab433cd0f374366d491cb8468ebc7d0912e..2eed7b47d26b0ea0d65331e8dc9f3f5b1afcfd87 100644 (file)
@@ -1,23 +1,23 @@
 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
@@ -393,7 +393,6 @@ TUPLE: bob a b ;
 [ "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 ;
@@ -408,12 +407,11 @@ M: integer harhar M\\ integer harhar drop ;\n"""
     [ \ 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 } ;
 """
@@ -422,10 +420,38 @@ 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