(define-test-module (test module sph lang sescript) (import (sph lang sescript)) (define-test (sescript->ecmascript input) (call-with-output-string (l (port) (sescript->ecmascript (list input) port)))) (test-execute-procedures-lambda (sescript->ecmascript (define a (lambda (a b) 1 2 3)) "var a=(function(a,b){1;2;return(3);});" (array #\a) "[\"a\"];" (array "\"") "[\"\\\"\"];" (array #t) "[true];" (begin a->b a-b a! a& a?) "a_to_b;a_b;a_x;a_ampersand;a_p;" (switch a (1 "b" break) (2 "c" "d") (default "e") (3 "f")) "switch(a){case 1:\"b\";break;case 2:\"c\";\"d\";default:\"e\";case 3:\"f\"};" (begin 1 a #t #\a "1" ) "1;a;true;\"a\";\"1\";" (begin 1 (begin 2 3)) "1;2;3;" (= 1 2 3) "(1===2)&&(2===3);" (and 1 2 3) "(1&&2&&3);" (array 1 2 3) "[1,2,3];" (chain c (chain a b) 1 2 "d") "b.a().c(1,2,\"d\");" (cond (a b) ((= c 3) #f #t) (else #t #f)) "if(a){b}else if(c===3){false;true;}else{true;false;};" (cond (a b)) "if(a){b};" (declare a) "var a;" (declare a b c) "var a,b,c;" (define a 1) "var a=1;" (define a 1 b 2) "var a=1,b=2;" (define (a b c-d) 1 2 3) "function a(b,c_d){1;2;return(3);};" (for ((set index 0) (< index len) (set index (+ 1 index))) #t) "for(index=0;(index