Better types #15

Merged
alex-eg merged 27 commits from better-types into main 2025-10-30 16:05:44 +01:00
2 changed files with 61 additions and 67 deletions
Showing only changes of commit 6d2f7179c1 - Show all commits

View File

@@ -1,6 +1,6 @@
(test-begin "basic") (test-group "basic"
;;; unkebabify ;; unkebabify
(test '- (unkebabify '-)) (test '- (unkebabify '-))
(test '-- (unkebabify '--)) (test '-- (unkebabify '--))
(test '-> (unkebabify '->)) (test '-> (unkebabify '->))
@@ -11,25 +11,21 @@
(test '_this_->_member_ (unkebabify '-this-->-member-)) (test '_this_->_member_ (unkebabify '-this-->-member-))
(test '__->>> (unkebabify '--->>>)) (test '__->>> (unkebabify '--->>>))
;;; atom-to-fmt-c ;; atom-to-fmt-c
(test '%fun (atom-to-fmt-c 'fn)) (test '%fun (atom-to-fmt-c 'fn))
(test '%prototype (atom-to-fmt-c 'prototype)) (test '%prototype (atom-to-fmt-c 'prototype))
(test '%var (atom-to-fmt-c 'var))
(test '%block-begin (atom-to-fmt-c 'begin)) (test '%block-begin (atom-to-fmt-c 'begin))
(test '%define (atom-to-fmt-c 'define)) (test '%define (atom-to-fmt-c 'define))
(test '%pointer (atom-to-fmt-c 'pointer)) (test '%pointer (atom-to-fmt-c 'pointer))
(test '%array (atom-to-fmt-c 'array)) (test '%array (atom-to-fmt-c 'array))
(test 'vector-ref (atom-to-fmt-c '¤)) (test 'vector-ref (atom-to-fmt-c '¤))
(test '%include (atom-to-fmt-c 'include)) (test '%include (atom-to-fmt-c 'include))
(test '%cast (atom-to-fmt-c 'cast))
;;; c89 stuff ;; c89 stuff
(test 'int (atom-to-fmt-c 'bool)) (test 'int (atom-to-fmt-c 'bool))
(test 1 (atom-to-fmt-c 'true)) (test 1 (atom-to-fmt-c 'true))
(test 0 (atom-to-fmt-c 'false)) (test 0 (atom-to-fmt-c 'false))
;;; make-field-access ;; make-field-access
(test 'a.b (make-field-access '(.b a))) (test 'a.b (make-field-access '(.b a)))
(test 'a.b.c (make-field-access '(.c a.b))) (test 'a.b.c (make-field-access '(.c a.b))))
(test-end)

View File

@@ -8,7 +8,7 @@
'(pub fn float sum ((int a) (int b)) '(pub fn float sum ((int a) (int b))
(return (cast float (+ a b))))) (return (cast float (+ a b)))))
(test-begin "semen") (test-group "semen"
(test-assert (sex-fn? print-str-fn)) (test-assert (sex-fn? print-str-fn))
(test #f (sex-fn-public? print-str-fn)) (test #f (sex-fn-public? print-str-fn))
(test 'void (sex-fn-return-type print-str-fn)) (test 'void (sex-fn-return-type print-str-fn))
@@ -53,6 +53,4 @@
(test '((fn void foo ((int a) (int b)) (test '((fn void foo ((int a) (int b))
(return (+ a (* 10 b))))) (return (+ a (* 10 b)))))
(semen-process sex-code-macro))) (semen-process sex-code-macro))))
(test-end)