32 lines
1.0 KiB
Common Lisp
32 lines
1.0 KiB
Common Lisp
(in-package :passepartout)
|
|
|
|
(defun gateway-cli-input (text)
|
|
"Processes raw text from the command line."
|
|
(inject-stimulus (list :type :EVENT
|
|
:payload (list :sensor :user-input :text text)
|
|
:meta (list :source :CLI))))
|
|
|
|
(defskill :passepartout-gateway-cli
|
|
:priority 100
|
|
:trigger (lambda (ctx) (eq (getf (getf ctx :meta) :source) :CLI))
|
|
:deterministic (lambda (action ctx) (declare (ignore ctx)) action))
|
|
|
|
(eval-when (:compile-toplevel :load-toplevel :execute)
|
|
(ql:quickload :fiveam :silent t))
|
|
|
|
(defpackage :passepartout-gateway-cli-tests
|
|
(:use :cl :fiveam :passepartout)
|
|
(:export #:cli-suite))
|
|
|
|
(in-package :passepartout-gateway-cli-tests)
|
|
|
|
(def-suite cli-suite :description "Verification of the CLI Gateway")
|
|
(in-suite cli-suite)
|
|
|
|
(test test-gateway-cli-input-format
|
|
"Contract 1: gateway-cli-input injects a properly formed signal without error."
|
|
(handler-case
|
|
(gateway-cli-input "hello")
|
|
(error (c)
|
|
(fail "gateway-cli-input crashed: ~a" c))))
|