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