migrate to Chicken 6
This commit is contained in:
@@ -13,6 +13,14 @@
|
||||
(test '_this_->_member_ (unkebabify '-this-->-member-))
|
||||
(test '__->>> (unkebabify '--->>>))
|
||||
|
||||
;; Non-ASCII identifiers must survive intact. The `regex' egg's
|
||||
;; string-substitute drops one trailing character per multi-byte
|
||||
;; character, which renames things silently -- the C still compiles,
|
||||
;; just under a different name than was written.
|
||||
(test 'naïve_count (unkebabify 'naïve-count))
|
||||
(test 'aï_b (unkebabify 'aï-b))
|
||||
(test 'ïï (unkebabify 'ïï))
|
||||
|
||||
;; atom-to-fmt-c
|
||||
(test '%fun (atom-to-fmt-c 'fn))
|
||||
(test '%prototype (atom-to-fmt-c 'prototype))
|
||||
|
||||
24
tests/sex-programs/unicode.sex
Normal file
24
tests/sex-programs/unicode.sex
Normal file
@@ -0,0 +1,24 @@
|
||||
(input)
|
||||
(output "café 日本語 🍺" "café1" "naïve: 3")
|
||||
(return 0)
|
||||
|
||||
;;; Non-ASCII string literals and identifiers.
|
||||
;;;
|
||||
;;; Two things are pinned here. First, a character outside printable
|
||||
;;; ASCII must reach the C compiler as the UTF-8 bytes it was written
|
||||
;;; as. Octal escapes are used because C's \x escape swallows every
|
||||
;;; following hex digit: "café1" is the case that catches it, since a
|
||||
;;; hex escape would run "\xc3\xa9" into the "1" and produce a value out
|
||||
;;; of range for a char. Second, a kebab-case identifier containing
|
||||
;;; non-ASCII characters must survive unkebabify intact -- getting this
|
||||
;;; wrong truncates the name silently, and the program still compiles
|
||||
;;; and runs, just under a different name than the one written.
|
||||
|
||||
(include stdio.h)
|
||||
|
||||
(pub fn main () int
|
||||
(puts "café 日本語 🍺")
|
||||
(puts "café1")
|
||||
(var naïve-count int 3)
|
||||
(printf "naïve: %d\n" naïve-count)
|
||||
(return 0))
|
||||
Reference in New Issue
Block a user