From c46568c832c61531cbb72ddd2352273e1bffd572 Mon Sep 17 00:00:00 2001 From: Kritphong Mongkhonvanit Date: Wed, 14 Aug 2019 12:06:42 +0700 Subject: [PATCH] Support Chicken 5 - Add an egg file - Adjust list of imported modules based on Chicken version --- foops.scm | 17 +++++++++++------ ssql.egg | 9 +++++++++ ssql.scm | 22 +++++++++++++++++----- tests/ansi-test.scm | 9 +++++++-- tests/composition-test.scm | 9 +++++++-- tests/foops-test.scm | 10 +++++++--- tests/run.scm | 23 +++++++++++++++++------ tests/transformations-test.scm | 9 +++++++-- 8 files changed, 82 insertions(+), 26 deletions(-) create mode 100644 ssql.egg diff --git a/foops.scm b/foops.scm index 39bc317..73c3c51 100644 --- a/foops.scm +++ b/foops.scm @@ -2,11 +2,16 @@ (make-object derive-object) -(import chicken scheme) -(use matchable) -(import-for-syntax chicken) -(begin-for-syntax - (use srfi-1)) +(cond-expand + (chicken-4 + (import chicken scheme) + (import-for-syntax chicken) + (use matchable) + (begin-for-syntax + (use srfi-1))) + (chicken-5 + (import-for-syntax srfi-1) + (import scheme matchable (chicken syntax)))) (define-for-syntax args-without-self '(if (and (pair? args) (procedure? (car args))) @@ -53,4 +58,4 @@ . ,(cadr x)) . ,(cddr x))))) -) \ No newline at end of file +) diff --git a/ssql.egg b/ssql.egg new file mode 100644 index 0000000..d84a663 --- /dev/null +++ b/ssql.egg @@ -0,0 +1,9 @@ +((version "0.2.4") + (synopsis "SQL as S-expressions") + (author "Peter Bex, Moritz Heidkamp") + (license "BSD") + (category db) + (dependencies matchable srfi-1 srfi-13) + (test-dependencies test) + (components (extension foops) + (extension ssql (component-dependencies foops)))) diff --git a/ssql.scm b/ssql.scm index c3c6d2a..30f991c 100644 --- a/ssql.scm +++ b/ssql.scm @@ -3,11 +3,23 @@ (ssql->sql ssql-connection scope-table find-tables ssql-compose register-sql-engine! define-operators *ansi-translator*) -(import chicken scheme) -(use matchable data-structures extras srfi-1 srfi-13 foops) -(import-for-syntax chicken) -(begin-for-syntax - (use srfi-1 srfi-13)) +(cond-expand + (chicken-4 + (import chicken scheme) + (use matchable data-structures extras srfi-1 srfi-13 foops) + (import-for-syntax chicken) + (begin-for-syntax + (use srfi-1 srfi-13))) + (chicken-5 + (import-for-syntax srfi-1 srfi-13 (chicken string)) + (import scheme + srfi-1 + srfi-13 + matchable + (chicken base) + (chicken format) + (chicken string) + foops))) (define (before? x y lst) (let loop ((lst lst)) diff --git a/tests/ansi-test.scm b/tests/ansi-test.scm index cd7cc59..3bb0437 100644 --- a/tests/ansi-test.scm +++ b/tests/ansi-test.scm @@ -1,4 +1,9 @@ -(use test) +(cond-expand + (chicken-4 + (use test)) + (chicken-5 + (import test))) + (import ssql) (test-group "selects" @@ -86,4 +91,4 @@ (test "IS NOT NULL" "SELECT NOT 'foo' IS NULL" - (ssql->sql #f '(select (not (null? "foo")))))) \ No newline at end of file + (ssql->sql #f '(select (not (null? "foo")))))) diff --git a/tests/composition-test.scm b/tests/composition-test.scm index c70cd24..35c862b 100644 --- a/tests/composition-test.scm +++ b/tests/composition-test.scm @@ -1,4 +1,9 @@ -(use test) +(cond-expand + (chicken-4 + (use test)) + (chicken-5 + (import test))) + (import ssql) (test-group "composition" @@ -11,4 +16,4 @@ (test "merge" '(select (columns firstname lastname age) (from artists) (order firstname lastname)) (ssql-compose #f '(select (columns firstname lastname) (order firstname)) - '((columns age) (from artists) (order lastname))))) \ No newline at end of file + '((columns age) (from artists) (order lastname))))) diff --git a/tests/foops-test.scm b/tests/foops-test.scm index 8e752e4..90aec1a 100644 --- a/tests/foops-test.scm +++ b/tests/foops-test.scm @@ -1,7 +1,11 @@ -(load-relative "../foops") +(cond-expand + (chicken-4 + (load-relative "../foops") + (use test)) + (chicken-5 + (import srfi-1 test foops))) (import foops) -(use test) (test-group "basic functionality" (define foo (make-object () ((bar) 'baz))) @@ -46,4 +50,4 @@ (test 'wroom (vehicle 'drive)) (test '(wroom wroom) (vehicle 'drive 2)) - (test '(fast wroom wroom wroom) (vehicle 'drive 3 'fast))) \ No newline at end of file + (test '(fast wroom wroom wroom) (vehicle 'drive 3 'fast))) diff --git a/tests/run.scm b/tests/run.scm index 755b1e2..12ac988 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -1,7 +1,18 @@ -(load-relative "foops-test") -(load-relative "../ssql") -(load-relative "transformations-test") -(load-relative "ansi-test") -(load-relative "composition-test") +(cond-expand + (chicken-4 + (load-relative "foops-test") + (load-relative "../ssql") + (load-relative "transformations-test") + (load-relative "ansi-test") + (load-relative "composition-test")) + (chicken-5 + (import test (chicken platform)) + (repository-path (cons ".." (repository-path))) + (load "foops-test") + (load "transformations-test") + (load "ansi-test") + (load "composition-test"))) + +(test-exit) + -(test-exit) \ No newline at end of file diff --git a/tests/transformations-test.scm b/tests/transformations-test.scm index f3f9f42..9f49c13 100644 --- a/tests/transformations-test.scm +++ b/tests/transformations-test.scm @@ -1,4 +1,9 @@ -(use test) +(cond-expand + (chicken-4 + (use test)) + (chicken-5 + (import test))) + (import ssql) (test-begin "inspection") @@ -39,4 +44,4 @@ (on (= roles.actor_id actors.id))) movies (on (= movies.id roles.movie_id))))))) -(test-end "scoping") \ No newline at end of file +(test-end "scoping")