{"size": 1545, "ext": "rktl", "max_stars_repo_path": "compatibility-test/tests/mzlib/cmdline.rktl", "max_stars_repo_name": "racket/compatibility", "max_stars_repo_stars_event_min_datetime": "2018-04-30T03:47:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-23T06:50:15.000Z", "max_issues_repo_path": "compatibility-test/tests/mzlib/cmdline.rktl", "max_issues_repo_name": "NoahStoryM/compatibility", "max_issues_repo_issues_event_min_datetime": "2016-10-20T01:47:49.000Z", "max_issues_repo_issues_event_max_datetime": "2020-11-27T21:10:14.000Z", "max_forks_repo_path": "compatibility-test/tests/mzlib/cmdline.rktl", "max_forks_repo_name": "NoahStoryM/compatibility", "max_forks_repo_forks_event_min_datetime": "2015-03-09T12:20:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-09T05:02:56.000Z"}
{"max_stars_count": 4, "max_issues_count": 6, "max_forks_count": 8, "avg_line_length": 39.6153846154, "max_line_length": 101, "alphanum_fraction": 0.5469255663}

(load-relative "loadtest.rktl")

(Section 'command-line)

(require mzlib/cmdline)

(test (void) 'cmdline
      (command-line "something" #("-ab")
        (once-each
         [("-a") "ok" 5]
         [("-b" "--more") "Help" 7])))

;; test that keywords are compared for the literal symbol
(test "foo" 'cmdline
      (let ([once-each 3] [args "args"])
        (command-line "something" #("-ab" "foo")
          (once-each
           [("-a") "ok" 5]
           [("-b" "--more") "Help" 7])
          (args (x) x))))

(syntax-test #'(command-line))
(syntax-test #'(command-line "hello"))
(err/rt-test (command-line 'hello #("ok")))
(syntax-test #'(command-line "hello" #("ok") (bad)))
(syntax-test #'(command-line "hello" #("ok") (once-any ())))
(syntax-test #'(command-line "hello" #("ok") (once-any ("-ok"))))
(syntax-test #'(command-line "hello" #("ok") (once-any ("-ok" "the ok flag"))))
(syntax-test #'(command-line "hello" #("ok") (once-any ("-ok" a "the ok flag"))))
(syntax-test #'(command-line "hello" #("ok") (once-any ("-ok" (a) "the ok flag"))))
(syntax-test #'(command-line "hello" #("ok") (once-any ("-ok" a "the ok flag") ())))
(syntax-test #'(command-line "hello" #("ok") (args 'done) (once-any ("-ok" a "the ok flag" 7))))
(syntax-test #'(command-line "hello" #("ok") (args (ok) 'done) (once-any ("-ok" a "the ok flag" 7))))
(syntax-test #'(command-line "hello" #("ok") (=> 'done) (once-any ("-ok" a "the ok flag" 7))))
(syntax-test #'(command-line "hello" #("ok") (=> 1 2 3 4) (once-any ("-ok" a "the ok flag" 7))))

(report-errs)
