From 3bfcfcc4eba7465dc4021b239582867bd093e5d1 Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Tue, 13 Apr 2021 04:09:26 +0200 Subject: [PATCH] Just a commit with stuff --- gherken.scm | 59 ++++++++++++++++++++++++++++++--------------------- tests/run.scm | 2 +- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/gherken.scm b/gherken.scm index 2ba63f0..5f1acaf 100644 --- a/gherken.scm +++ b/gherken.scm @@ -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))) + )) diff --git a/tests/run.scm b/tests/run.scm index f21409d..12b0b2d 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -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 _ ", ")