~ubuntu-branches/ubuntu/karmic/cl-getopt/karmic

« back to all changes in this revision

Viewing changes to tests.lisp

  • Committer: Bazaar Package Importer
  • Author(s): Kevin M. Rosenberg
  • Date: 2008-03-14 09:00:57 UTC
  • mfrom: (1.1.1 upstream) (3.1.1 hardy)
  • Revision ID: james.westby@ubuntu.com-20080314090057-al4ijqwinki5kwl9
Tags: 1.2.0-1
New upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
;;;; Author:        Kevin M. Rosenberg
8
8
;;;; Date Started:  Sep 2003
9
9
;;;;
10
 
;;;; $Id: tests.lisp 8724 2004-03-14 22:37:29Z kevin $
 
10
;;;; $Id$
11
11
;;;;
12
12
;;;; This file is Copyright (c) 2003 by Kevin M. Rosenberg
13
13
;;;;
24
24
(defun do-tests ()
25
25
  (with-tests (:name "GETOPT")
26
26
    (let ((*break-on-test-failures* nil))
27
 
      
 
27
 
28
28
      ;; match-unique-abbreviation
29
29
      (test nil (match-unique-abbreviation "abc" nil))
30
30
      (test nil (match-unique-abbreviation "abc" '("ab")))
34
34
      (test nil (match-unique-abbreviation "ab" '("ab" "abc")))
35
35
      (test 1 (match-unique-abbreviation "ac" '("ab" "ac")))
36
36
      (test 1 (match-unique-abbreviation "ac" '("ab" "acb")))
37
 
      
 
37
 
38
38
      ;; getopt
39
39
      (test-mv '(("argv") nil nil) (getopt '("argv") nil))
40
40
      (test-mv '(("argv" "2") nil nil) (getopt '("argv" "2") nil))
41
 
      
 
41
 
42
42
      (test-mv '(("argv") (("c")) nil) (getopt '("argv" "-c") '(("c" :none))))
43
 
      
44
 
      (test-mv '(("argv") (("c" . "val")) nil) 
45
 
               (getopt '("argv" "-c" "val") '(("c" :optional))))
46
 
      (test-mv '(("argv" "v1") (("c" . "val")) nil) 
47
 
               (getopt '("argv" "-c" "val" "v1") '(("c" :optional))))
48
 
      (test-mv '(( "v1") (("colon" . "val")) nil) 
49
 
               (getopt '("--colon" "val" "v1") '(("colon" :optional))))
50
 
      (test-mv '(("ab" "-c") (("colon" . "val")) nil) 
51
 
               (getopt '("ab" "--colon" "val" "--" "-c") 
52
 
                       '(("colon" :optional) ("-c" :none))))
53
 
      (test-mv '(("argv") (("c" . "cd")) nil) 
54
 
               (getopt '("argv" "-c" "cd") '(("c" :required))))
55
 
      (test-mv '(("argv") nil ("c")) 
56
 
               (getopt '("argv" "-c") '(("c" :required))))
57
 
      (test-mv '(("argv") (("c" . "10")) nil) 
58
 
               (getopt '("argv" "-c=10") '(("c" :required))))
59
 
      (test-mv '(("argv") nil ("c")) 
60
 
               (getopt '("argv" "-c=10") '(("c" :none))))
61
 
      (test-mv '(nil (("along" . "10")) nil) 
62
 
               (getopt '("--along=10") '(("along" :optional))))
63
 
      (test-mv '(nil nil ("along")) 
64
 
               (getopt '("--along=10") '(("along" :none)))) 
65
 
      (test-mv '(nil (("along" . "10")) nil) 
66
 
               (getopt '("--a=10") '(("along" :optional)))) 
 
43
 
 
44
      (test-mv '(("argv") (("c" . "val")) nil)
 
45
               (getopt '("argv" "-c" "val") '(("c" :optional))))
 
46
      (test-mv '(("argv" "v1") (("c" . "val")) nil)
 
47
               (getopt '("argv" "-c" "val" "v1") '(("c" :optional))))
 
48
      (test-mv '(( "v1") (("colon" . "val")) nil)
 
49
               (getopt '("--colon" "val" "v1") '(("colon" :optional))))
 
50
      (test-mv '(("ab" "-c") (("colon" . "val")) nil)
 
51
               (getopt '("ab" "--colon" "val" "--" "-c")
 
52
                       '(("colon" :optional) ("-c" :none))))
 
53
      (test-mv '(("argv") (("c" . "cd")) nil)
 
54
               (getopt '("argv" "-c" "cd") '(("c" :required))))
 
55
      (test-mv '(("argv") nil ("c"))
 
56
               (getopt '("argv" "-c") '(("c" :required))))
 
57
      (test-mv '(("argv") (("c" . "10")) nil)
 
58
               (getopt '("argv" "-c=10") '(("c" :required))))
 
59
      (test-mv '(("argv") nil ("c"))
 
60
               (getopt '("argv" "-c=10") '(("c" :none))))
 
61
      (test-mv '(nil (("along" . "10")) nil)
 
62
               (getopt '("--along=10") '(("along" :optional))))
 
63
      (test-mv '(nil nil ("along"))
 
64
               (getopt '("--along=10") '(("along" :none))))
 
65
      (test-mv '(nil (("along" . "10")) nil)
 
66
               (getopt '("--a=10") '(("along" :optional))))
67
67
      (test-mv '(nil nil ("a"))
68
 
               (getopt '("--a=10") '(("along" :optional) ("aboot" :optional))))
 
68
               (getopt '("--a=10") '(("along" :optional) ("aboot" :optional))))
69
69
      (test-mv '(("a") nil nil)
70
70
               (getopt '("a") '(("a" :none))))
 
71
      (test-mv '(("a") (("foo") ("bar")) nil)
 
72
               (getopt '("a" "--foo" "--bar") '(("foo" :none) ("bar" :none))))
 
73
      (test-mv '(("a") (("foo") ("bar")) nil)
 
74
               (getopt '("a" "--f" "--bar") '(("foo" :none) ("bar" :none))))
71
75
      ))
72
76
  t)