X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-syntax.lisp;h=ed1f4817c604f3926a84304afe1b93e2928932dd;hb=2645bad6c8673a32408801e7ea1f8a02a1583d7d;hp=1127d3294c213970996d950b2cc9d3958e03db3e;hpb=66ed75626689968e1faa7603a36954ef4364b2e2;p=clsql.git diff --git a/tests/test-syntax.lisp b/tests/test-syntax.lisp index 1127d32..ed1f481 100644 --- a/tests/test-syntax.lisp +++ b/tests/test-syntax.lisp @@ -1,21 +1,20 @@ ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- -;;;; ====================================================================== -;;;; File: test-syntax.lisp -;;;; Author: Marcus Pearce -;;;; Created: 30/03/2004 -;;;; Updated: $Id$ -;;;; ====================================================================== +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION ;;;; -;;;; Description ========================================================== -;;;; ====================================================================== +;;;; Name: clsql.asd +;;;; Purpose: Tests for the CLSQL Symbolic SQL syntax. +;;;; Authors: Marcus Pearce and Kevin M. Rosenberg +;;;; Created: March 2004 ;;;; -;;;; Tests for the CLSQL Symbolic SQL syntax. -;;;; -;;;; ====================================================================== +;;;; CLSQL users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. +;;;; ************************************************************************* (in-package #:clsql-tests) -#.(clsql:locally-enable-sql-reader-syntax) +(clsql-sys:file-enable-sql-reader-syntax) (setq *rt-syntax* @@ -410,4 +409,18 @@ )) -#.(clsql:restore-sql-reader-syntax-state) +(defun test-output-sql/sql-ident-table () + (let ((tests `((,(make-instance 'sql-ident-table :name :foo) "FOO") + (,(make-instance 'sql-ident-table :name :foo-bar) "FOO_BAR") + (,(make-instance 'sql-ident-table :name "foo") "\"foo\"") + (,(make-instance 'sql-ident-table :name '|foo bar|) "\"foo bar\"") + (,(make-instance 'sql-ident-table :name :foo :table-alias :bar) "FOO BAR" ) + (,(make-instance 'sql-ident-table :name :foo_bar :table-alias :bar-bast) "FOO_BAR BAR_BAST") + (,(make-instance 'sql-ident-table :name "foo" :table-alias "Bar") "\"foo\" \"Bar\"") + (,(make-instance 'sql-ident-table :name '|foo bar| :table-alias :bast) "\"foo bar\" BAST")))) + (loop for (test expected-result) in tests + for test-out = (with-output-to-string (*sql-stream*) (output-sql test nil)) + do (assert (string-equal test-out expected-result) + (test test-out expected-result) + "Test:~s didnt match ~S" + test-out expected-result))))