(use posix test srfi-18 json) (define (test-commands desc result commands) (test desc (string-append result "\n") (with-output-to-string (lambda () (with-input-from-string (string-append commands "\n") (lambda () (load-relative "../couchdb-view-server.scm"))))))) (test-commands "reset" "true" "[\"reset\", {}]") (test-commands "add_fun and map_doc" "true\n[[[null, 100]]]" #< (ref 'score doc) 50) (emit null `#((player_name . ,(ref 'name doc))))))"] ["map_doc", {"_id":"8877AFF9789988EE","_rev":"3-235256484","name":"John Smith","score": 60}] ["reduce",["(lambda (k v r) (fold + 0 v))","(lambda (k v r) (apply * v))"],[[[1,"699b524273605d5d3e9d4fd0ff2cb272"],10],[[2,"c081d0f69c13d2ce2050d684c7ba2843"],20],[[null,"foobar"],3]]] ["rereduce",["(lambda (k v r) (fold + 0 v))"],[33,55,66]] END ) (test-commands "fun with log" #<