From eda507c3d35f484755f88f6bbbf3f9a880324a97 Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Fri, 1 Jul 2011 14:41:36 -0400 Subject: [PATCH] added output-caching tests to ensure that the output cache works correctly and can be disabled --- tests/test-init.lisp | 4 ++-- tests/test-internal.lisp | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/test-init.lisp b/tests/test-init.lisp index 394a20a..64253bd 100644 --- a/tests/test-init.lisp +++ b/tests/test-init.lisp @@ -72,12 +72,12 @@ (defun default-suites () "The default list of tests to run." - (append *rt-internal* *rt-connection* *rt-basic* *rt-fddl* *rt-fdml* + (append *rt-connection* *rt-basic* *rt-fddl* *rt-fdml* *rt-ooddl* *rt-oodml* *rt-syntax* *rt-time* *rt-i18n*)) (defun internal-suites () "The default internal suites that should run without any specific backend" - (append *rt-pool*)) + (append *rt-internal* *rt-pool*)) (defvar *error-count* 0) diff --git a/tests/test-internal.lisp b/tests/test-internal.lisp index adfab8a..1416862 100644 --- a/tests/test-internal.lisp +++ b/tests/test-internal.lisp @@ -38,5 +38,34 @@ (clsql-sys::prepared-sql-to-postgresql-sql "SELECT 'FOO' FROM BAR WHERE ID='Match?''?' AND CODE=?") "SELECT 'FOO' FROM BAR WHERE ID='Match?''?' AND CODE=$1") + (deftest :int/output-caching/1 + #.(locally-enable-sql-reader-syntax) + ;; ensure that key generation and matching is working + ;; so that this table doesnt balloon (more than designed) + (list + (progn (clsql:sql [foo]) + (clsql:sql [foo]) + (hash-table-count clsql-sys::*output-hash*)) + + (progn (clsql:sql [foo.bar]) + (clsql:sql [foo bar]) + (hash-table-count clsql-sys::*output-hash*)) + (progn (clsql:sql (clsql-sys:sql-expression + :table (clsql-sys::database-identifier 'foo) + :attribute (clsql-sys::database-identifier 'bar))) + (clsql:sql (clsql-sys:sql-expression + :table (clsql-sys::database-identifier 'foo) + :attribute (clsql-sys::database-identifier 'bar))) + (hash-table-count clsql-sys::*output-hash*))) + (1 2 2)) + + (deftest :int/output-caching/2 + #.(locally-enable-sql-reader-syntax) + ;; ensure that we can disable the output cache and + ;; still have everything work + (let ((clsql-sys::*output-hash*)) + (list (clsql:sql [foo]) (clsql:sql [foo]) (clsql:sql [foo.bar]))) + ("FOO" "FOO" "FOO.BAR")) + )) -- 2.34.1