Test output for mw [ok]
Testing time: 2s
/root/salmonella-run-publish/chicken/bin/csi -script run.scm < /dev/null ;;; BEGIN "mw" TESTS ;; 1. Raw XML response from Wikipedia (let* ((response (raw-api-call (quote ((action . query) (meta . siteinfo) (format . xml))))) (len (string-length response))) (string-append (substring response 0 33) (substring response (- len 14)))) ;; ==> "<?xml version=\"1.0\"?><api><query></query></api>" ;; Passed. ;; 2. Raw json response from Wikipedia (let* ((response (raw-api-call (quote ((action . query) (meta . siteinfo) (format . json))))) (len (string-length response))) (substring response 0 32)) ;; ==> "{\"query\":{\"general\":{\"mainpage\":" ;; Passed. ;; 3. pipejoin (pipejoin (quote (a "b" "c d" 12))) ;; ==> "a|b|c d|12" ;; Passed. ;; 4. sx-call sanity check (let* ((response (sx-call (quote ((action . query) (meta . siteinfo)))))) (map (sxpath "api/query/general/@wikiid") response)) ;; ==> (((wikiid "enwiki"))) ;; Passed. ;; 5. check a user's edit count (let* ((response (user-details "TonyBot")) (s ((sxpath "api/query/allusers/u/@editcount") response))) (signum (- (string->number (cadar s)) 2134))) ;; ==> 1 ;; Passed. ;; 6. prop-revisions (let* ((response (sx-call (prop-revisions "Scheme (programming language)" startid: 321830591 endid: 321830591 section: 6 prop: (quote content)))) (content ((sxpath "//text()") response)) (text (and (pair? content) (car content)))) (substring text 99 114)) ;; ==> "lambda calculus" ;; Passed. ;; 7. prop-categories (let* ((response (sx-call (prop-categories "Abraham Lincoln" categories: "Category: Presidents of the United States"))) (content ((sxpath "//categories/cl/@title") response))) (and (pair? content) (cadar content))) ;; ==> "Category:Presidents of the United States" ;; Passed. ;; 8. Fetch just two revisions (let* ((response (sx-call-once (prop-revisions "Main Page" limit: 2))) (revids ((sxpath "api/query/pages/page/revisions/rev/@revid") response)) (count (length revids))) count) ;; ==> 2 ;; Passed. ;;; END "mw" TESTS: PASSED ;;; (Total: 8 Passed: 8 Failed: 0)