Welcome to the CHICKEN Scheme pasting service
Example test (json-rpc-dispatch) added by rgherdt on Mon Apr 10 12:49:12 2023
(import (scheme base) (chicken base) (srfi 64) (json-rpc lolevel)) (test-begin "json-rpc tests") (parameterize ((json-rpc-handler-table `(("hello" . ,(lambda (params) (let ((name (cdr (assoc 'name params)))) (string-append "Hello " name))))))) ;; When method is not a string, an exception should be raised. ;; With -O2, this works as expected, since method is a string. ;; With -O3, an exception is raised. (test-equal "Hello World!" (alist-ref 'result (json-rpc.lolevel#json-rpc-dispatch '((id . 1) (method . "hello") (params . ((name . "World!"))))))) ) (test-end "json-rpc tests")