summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorArun Isaac2022-01-16 12:42:20 +0530
committerArun Isaac2022-01-16 13:17:06 +0530
commitb3f18dbf95d80d92a708f04be53b8d98b7980a80 (patch)
tree3aeee9583b25cef941c415f34aade707b3bf26b4 /tests
parent647f020ccd409e83320e8d11859035856770c91f (diff)
downloadccwl-b3f18dbf95d80d92a708f04be53b8d98b7980a80.tar.gz
ccwl-b3f18dbf95d80d92a708f04be53b8d98b7980a80.tar.lz
ccwl-b3f18dbf95d80d92a708f04be53b8d98b7980a80.zip
ccwl: Raise exceptions on input syntax errors.
* ccwl/ccwl.scm: Import (rnrs conditions), (rnrs exceptions) and (ccwl
conditions).
(input, input-spec-id): Raise &ccwl-violation
conditions on syntax errors.
* tests/ccwl.scm: Import (rnrs exceptions) and (ccwl conditions).
(input): New function.
("input, when passed more than one positional argument, must raise a
&ccwl-violation condition", "input, when passed an unrecognized
keyword, must raise a &ccwl-violation condition", "input, when passed
multiple arguments to a unary keyword, must raise a &ccwl-violation
condition"): New tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/ccwl.scm24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/ccwl.scm b/tests/ccwl.scm
index 015dcde..bc9fb01 100644
--- a/tests/ccwl.scm
+++ b/tests/ccwl.scm
@@ -16,8 +16,13 @@
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with ccwl.  If not, see <https://www.gnu.org/licenses/>.
 
-(use-modules (srfi srfi-64)
-             (ccwl ccwl))
+(use-modules (rnrs exceptions)
+             (srfi srfi-64)
+             (ccwl ccwl)
+             (ccwl conditions))
+
+(define input
+  (@@ (ccwl ccwl) input))
 
 (test-begin "ccwl")
 
@@ -47,4 +52,19 @@
                        (output-type output)))
                (cwl-workflow-outputs cwl-workflow)))))
 
+(test-assert "input, when passed more than one positional argument, must raise a &ccwl-violation condition"
+  (guard (exception
+          (else (ccwl-violation? exception)))
+    (input #'(message string))))
+
+(test-assert "input, when passed an unrecognized keyword, must raise a &ccwl-violation condition"
+  (guard (exception
+          (else (ccwl-violation? exception)))
+    (input #'(message #:foo string))))
+
+(test-assert "input, when passed multiple arguments to a unary keyword, must raise a &ccwl-violation condition"
+  (guard (exception
+          (else (ccwl-violation? exception)))
+    (input #'(message #:type int string))))
+
 (test-end "ccwl")