about summary refs log tree commit diff stats
path: root/059to_text.mu
diff options
context:
space:
mode:
Diffstat (limited to '059to_text.mu')
-rw-r--r--059to_text.mu17
1 files changed, 17 insertions, 0 deletions
diff --git a/059to_text.mu b/059to_text.mu
index 207ade78..30761eb9 100644
--- a/059to_text.mu
+++ b/059to_text.mu
@@ -29,3 +29,20 @@ scenario array-to-text-line-early-warning-for-static-dispatch [
   x:text <- array-to-text-line n
   # just ensure there were no errors
 ]
+
+# finally, a specialization for single characters
+def to-text c:character -> y:text [
+  local-scope
+  load-ingredients
+  y <- new character:type, 1/capacity
+  *y <- put-index *y, 0, c
+]
+
+scenario character-to-text [
+  1:character <- copy 111/o
+  2:text <- to-text 1:character
+  3:array:character <- copy *2:text
+  memory-should-contain [
+    3:array:character <- [o]
+  ]
+]