Just a commit with stuff

This commit is contained in:
Daniel Ziltener 2021-04-13 04:09:26 +02:00
parent f6fa2a0031
commit 3bfcfcc4eb
2 changed files with 36 additions and 25 deletions

View File

@ -15,35 +15,46 @@
srfi-69 srfi-69
srfi-78 srfi-78
srfi-123 srfi-123
srfi-133
srfi-152 srfi-152
srfi-197) srfi-197)
(export given run-features) (export given run-features)
(begin (begin
(define lang-registry (make-hash-table)) (define lang-registry (make-hash-table))
(define-syntax given (define-syntax given
(syntax-rules () (syntax-rules ()
((given picklex args ...) ((given picklex args ...)
(hash-table-set! lang-registry picklex (lambda args ...))))) (hash-table-set! lang-registry picklex (lambda args ...)))))
(define (run-pickle data tags) (define (run-step data)
#t) #t)
(define (run-feature filename tags) (define (run-pickle data tags)
(let ((pickles (chain (capture ("./gherkinexe" "--no-ast" "--no-source" filename)) (vector-map
(string-trim-both _) (lambda (chunk)
(string-split _ "\n") (vector-map
(string-join _ ", ") (lambda (step)
(list "[" _ "]") (run-step data))
(string-concatenate _) (alist-ref 'steps chunk)))
(with-input-from-string _ read-json)))) data)))
(map
(lambda (x) (run-pickle x tags))
pickles)))
(define (run-features dir #!rest tags) (define (run-feature filename tags)
(let ((featurefiles (find-files dir test: '(: (* any) ".feature")))) (let ((pickles (chain (capture ("./gherkinexe" "--no-ast" "--no-source" filename))
(map (string-trim-both _)
(lambda (x) (run-feature x tags)) (string-split _ "\n")
featurefiles))) (string-join _ ", ")
)) (list "[" _ "]")
(string-concatenate _)
(with-input-from-string _ read-json)
(vector-map (lambda (x) (alist-ref 'pickle x)) _))))
(vector-map
(lambda (x) (run-pickle x tags))
pickles)))
(define (run-features dir #!rest tags)
(let ((featurefiles (find-files dir test: '(: (* any) ".feature"))))
(map
(lambda (x) (run-feature x tags))
featurefiles)))
))

View File

@ -11,7 +11,7 @@
(chicken port)) (chicken port))
(define pickle (define pickle
(chain (capture ("./gherkinexe" "--no-ast" "--no-source" "cucumber/gherkin/c/testdata/good/tags.feature")) (chain (capture ("./gherkinexe" "--no-ast" "--no-source" "cucumber/gherkin/c/testdata/good/rule.feature"))
(string-trim-both _) (string-trim-both _)
(string-split _ "\n") (string-split _ "\n")
(string-join _ ", ") (string-join _ ", ")