]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.tools.inspector: Fix inspector for map-index change.
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 24 Jun 2022 23:19:25 +0000 (18:19 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 24 Jun 2022 23:19:25 +0000 (18:19 -0500)
First casualty of df23a5aeb1de82ebfcf49fc3f653bc1e69d3dab5

basis/ui/tools/inspector/inspector-tests.factor
basis/ui/tools/inspector/inspector.factor

index 5891983a7e95cf1c41c4a55365e3e97578d01256..7127d5d01afa283ad438117f3805e5d87d2aadd0 100644 (file)
@@ -1,3 +1,28 @@
-USING: tools.test ui.tools.inspector math models ;
+USING: assocs formatting kernel math math.parser models
+sequences strings tools.test ui.tools.inspector unicode ;
 
 { } [ \ + <model> <inspector-gadget> com-edit-slot ] unit-test
+
+! Make sure we can click around in the inspector
+{ } [
+    "abcdefg" [
+        swap [ dup number>string ] dip dup
+        dup unicode:printable? [ 1string ] [
+            dup 0xff <= [
+                H{
+                    { CHAR: \a "\\a" }
+                    { CHAR: \b "\\b" }
+                    { CHAR: \e "\\e" }
+                    { CHAR: \f "\\f" }
+                    { CHAR: \n "\\n" }
+                    { CHAR: \r "\\r" }
+                    { CHAR: \t "\\t" }
+                    { CHAR: \v "\\v" }
+                    { CHAR: \0 "\\0" }
+                } ?at [ "\\x%02x" sprintf ] unless
+            ] [
+                "\\u{%x}" sprintf
+            ] if
+        ] if slot-description boa
+    ] { } map-index-as drop
+] unit-test
\ No newline at end of file
index cfcd6e0e0992d7fe66d9022fdcf467e8d38c3486..47227e1fd4cdeb387224e8ec77f5e33ad854eb82 100644 (file)
@@ -88,7 +88,7 @@ M: string make-slot-descriptions
                 "\\u{%x}" sprintf
             ] if
         ] if slot-description boa
-    ] map-index ;
+    ] { } map-index-as ;
 
 M: hashtable make-slot-descriptions
     call-next-method [ key-string>> ] sort-with ;