add sex-tests

This commit is contained in:
2025-07-31 18:57:20 +03:00
parent 3e535c9517
commit 4b6a7d5209
4 changed files with 45 additions and 4 deletions

View File

@@ -1,12 +1,12 @@
CHICKEN_C = csc
MODULES = sexc main modules templates utils
MODULES = sexc modules templates utils
OBJ = $(MODULES:%=%.o)
# chicken flags
CFLAGS = -compile-syntax
sexc: $(OBJ)
sexc: main.o $(OBJ)
$(CHICKEN_C) $^ -o $@
main.o: main.scm
@@ -15,5 +15,9 @@ main.o: main.scm
%.o: %.scm
$(CHICKEN_C) $< -e -c -o $@ $(CFLAGS)
sex-tests: $(OBJ) tests/run.scm
$(CHICKEN_C) tests/run.scm -c -o sex-tests.o
$(CHICKEN_C) $(OBJ) test.o -o sex-tests
clean:
rm -f $(OBJ) sexc
rm -f $(OBJ) sexc sex-tests

View File

@@ -14,7 +14,7 @@ By the way, there's a way to make Chicken install eggs non-globally. Refer to
the documentation for more info:
https://wiki.call-cc.org/man/5/Extension%20tools#changing-the-repository-location
~chicken-install fmt getopt-long brev-separate~
~chicken-install fmt getopt-long brev-separate test~
** Compilation
~make~

1
tests/Makefile Normal file
View File

@@ -0,0 +1 @@

36
tests/run.scm Normal file
View File

@@ -0,0 +1,36 @@
(declare (uses sexc))
(import
(chicken process)
(chicken process-context)
srfi-1
test)
;;; unkebabify
(test '- (unkebabify '-))
(test '-- (unkebabify '--))
(test '-> (unkebabify '->))
(test '-= (unkebabify '-=))
(test 'kebab_case (unkebabify 'kebab-case))
(test '_what_ (unkebabify '-what-))
(test 'this->member (unkebabify 'this->member))
(test '_this_->_member_ (unkebabify '-this-->-member-))
(test '__->>> (unkebabify '--->>>))
;;; atom-to-fmt-c
(test '%fun (atom-to-fmt-c 'fn))
(test '%prototype (atom-to-fmt-c 'prototype))
(test '%var (atom-to-fmt-c 'var))
(test '%begin (atom-to-fmt-c 'begin))
(test '%define (atom-to-fmt-c 'define))
(test '%pointer (atom-to-fmt-c 'pointer))
(test '%array (atom-to-fmt-c 'array))
(test 'vector-ref (atom-to-fmt-c '@))
(test '%include (atom-to-fmt-c 'include))
(test '%cast (atom-to-fmt-c 'cast))
;;; make-field-access
(test 'a.b (make-field-access '(.b a)))
(test 'a.b.c (make-field-access '(.c a.b)))
(test-exit)