plt/keyword-test.ss
;;;
;;; Time-stamp: <06/03/11 12:15:11 noel>
;;;
;;; Copyright (C) 2004 by Noel Welsh.
;;;

;;; This library is free software; you can redistribute it
;;; and/or modify it under the terms of the GNU Lesser
;;; General Public License as published by the Free Software
;;; Foundation; either version 2.1 of the License, or (at
;;; your option) any later version.

;;; Web testingis distributed in the hope that it will be
;;; useful, but WITHOUT ANY WARRANTY; without even the
;;; implied warranty of MERCHANTABILITY or FITNESS FOR A
;;; PARTICULAR PURPOSE.  See the GNU Lesser General Public
;;; License for more details.

;;; You should have received a copy of the GNU Lesser
;;; General Public License along with Web testing; if not,
;;; write to the Free Software Foundation, Inc., 59 Temple
;;; Place, Suite 330, Boston, MA 02111-1307 USA

;;; Author: Noel Welsh <noelwelsh@yahoo.com>
;;
;;
;; Commentary:

(module keyword-test mzscheme

  (require "test.ss"
           "keyword.ss")

  (provide keyword-tests)

  (define keyword-tests
    (test-suite
     "All Keyword tests"
     (test-case
      "get-keyword-arg default cases"
      (begin
        (check-equal?
         #f
         (get-keyword-arg 'foo '(a 1 b 2)))
        (check-equal?
         'bar
         (get-keyword-arg 'foo '(a 1 foo bar zed 2)))
        (check-equal?
         #f
         (get-keyword-arg 'foo '(a 1 bar)))
        (check-equal?
         'bar
         (get-keyword-arg 'foo '(1 foo bar)))))

     (test-case
      "get-keyword-arg w/ missing value cases"
      (begin
        (check-equal?
         'missing
         (get-keyword-arg 'foo '(a 1 b 2) 'missing))
        (check-equal?
         'bar
         (get-keyword-arg 'foo '(a 1 foo bar zed 2) 'missing))
        (check-equal?
         'missing
         (get-keyword-arg 'foo '(a 1 bar) 'missing))
        (check-equal?
         'bar
         (get-keyword-arg 'foo '(1 foo bar) 'missing))))

     (test-case
      "get-positional-args"
      (begin
        (check-equal?
         '(1 2 3 4)
         (get-positional-args '(foo bar) '(1 2 3 4)))
        (check-equal?
         '()
         (get-positional-args '(foo bar) '(foo 1 bar 2)))
        (check-equal?
         '(2 4)
         (get-positional-args '(foo bar) '(bar 1 2 foo 3 4)))))

     (test-case
      "get-positional-args w/ missing value"
      (begin
        (check-equal?
         'baz
         (get-positional-args '(foo bar) '(foo 1 bar 2) 'baz))))
     ))
  )