home: hub: zuo

ref: dcf77fa75d578d655ccb37d9d2b706d5eafcaa1a
dir: /tests/symbol.zuo/

View raw version
#lang zuo

(require "harness.zuo")

(alert "symbols")

(check (symbol? 'apple))
(check (symbol? (string->uninterned-symbol "apple")))
(check (not (symbol? "apple")))
(check (not (symbol? 10)))

(check (symbol->string 'apple) "apple")
(check-arg-fail (symbol->string "apple") "not a symbol")

(check (eq? 'apple (string->symbol "apple")))
(check (not (eq? 'apple (string->uninterned-symbol "apple"))))
(check (not (eq? (string->uninterned-symbol "apple")
                 (string->uninterned-symbol "apple"))))
(check (not (equal? 'apple (string->uninterned-symbol "apple"))))
(check-arg-fail (string->symbol 'apple) not-string)
(check-arg-fail (string->uninterned-symbol 'apple) not-string)

(check-arg-fail (string->symbol "apple\0spice") "without a nul character")
(check (symbol? (string->uninterned-symbol "apple\0spice")))