Skip to content

optparse can't pass argument into test runner properly #94

@Watson1978

Description

@Watson1978

The latest optparser changing can't pass argument into test runner properly since ruby/ruby@9e265b583b commit.

ruby -r test/unit -e'p ARGV; require "test/unit"; class T < Test::Unit::TestCase; def test_x = nil; end ' -- -v
["-v"]
invalid argument: -v
Test::Unit automatic runner.
Usage: -e [options] [-- untouched arguments]
    -r, --runner=RUNNER              Use the given RUNNER.
                                     (c[onsole], e[macs], x[ml])
        --collector=COLLECTOR        Use the given COLLECTOR.
                                     (de[scendant], di[r], l[oad], o[bject]_space)
    -n, --name=NAME                  Runs tests matching NAME.
                                     Use '/PATTERN/' for NAME to use regular expression.
                                     Regular expression accepts options.
                                     Example: '/taRget/i' matches 'target' and 'TARGET'
        --ignore-name=NAME           Ignores tests matching NAME.
                                     Use '/PATTERN/' for NAME to use regular expression.
                                     Regular expression accepts options.
                                     Example: '/taRget/i' matches 'target' and 'TARGET'
    -t, --testcase=TESTCASE          Runs tests in TestCases matching TESTCASE.
                                     Use '/PATTERN/' for TESTCASE to use regular expression.
                                     Regular expression accepts options.
                                     Example: '/taRget/i' matches 'target' and 'TARGET'
        --ignore-testcase=TESTCASE   Ignores tests in TestCases matching TESTCASE.
                                     Use '/PATTERN/' for TESTCASE to use regular expression.
                                     Regular expression accepts options.
                                     Example: '/taRget/i' matches 'target' and 'TARGET'
        --location=LOCATION          Runs tests that defined in LOCATION.
                                     LOCATION is one of PATH:LINE, PATH or LINE.
        --attribute=EXPRESSION       Runs tests that matches EXPRESSION.
                                     EXPRESSION is evaluated as Ruby's expression.
                                     Test attribute name can be used with no receiver in EXPRESSION.
                                     EXPRESSION examples:
                                       !slow
                                       tag == 'important' and !slow
        --[no-]priority-mode         Runs some tests based on their priority.
        --default-priority=PRIORITY  Uses PRIORITY as default priority
                                     (h[igh], i[mportant], l[ow], m[ust], ne[ver], no[rmal])
    -I, --load-path=DIR[:DIR...]     Appends directory list to $LOAD_PATH.
        --color-scheme=SCHEME        Use SCHEME as color scheme.
                                     (d[efault])
        --config=FILE                Use YAML format FILE content as configuration file.
        --order=ORDER                Run tests in a test case in ORDER order.
                                     (a[lphabetic], d[efined], r[andom])
        --max-diff-target-string-size=SIZE
                                     Shows diff if both expected result string size and actual result string size are less than or equal SIZE in bytes.
                                     (1000)
        --[no-]stop-on-failure       Stops immediately on the first non success test
                                     (false)
        --[no-]debug-on-failure      Run debugger if available on failure
                                     (false)
        --[no-]gc-stress             Enable GC.stress only while each test is running
                                     (false)
        --[no-]parallel=[thread]     Runs tests in parallel
                                     (thread)
        --n-workers=N                The number of parallelism
                                     (16)
    -v, --verbose=[LEVEL]            Set the output level (default is normal).
                                     (i[mportant-only], n[ormal], p[rogress], s[ilent], v[erbose])
        --[no-]use-color=[auto]      Uses color output
                                     (default is auto)
        --progress-row-max=MAX       Uses MAX as max terminal width for progress mark
                                     (default is auto)
        --progress-style=STYLE       Uses STYLE as progress style
                                     (f[ault-only], i[nplace], m[ark])
        --no-show-detail-immediately Shows not passed test details immediately.
                                     (default is yes)
        --[no-]reverse-output        Shows fault details in reverse.
                                     (default is yes for tty output, no otherwise)
        --[no-]report-slow-tests     Shows the top 5 slow tests in the summary output
                                     (false)
        --output-file-descriptor=FD  Outputs to file descriptor FD
        --                           Stop processing options so that the
                                     remaining options will be passed to the
                                     test.
    -h, --help                       Display this help.

Deprecated options:
        --console                    Console runner (use --runner).

Before the commit, it works well

$ ruby -r test/unit -e'p ARGV; require "test/unit"; class T < Test::Unit::TestCase; def test_x = nil; end ' -- -v
["-v"]
Loaded suite -e
Started
T:
  test_x:                                                                                                                                                               .: (0.000063)

Finished in 0.000255347 seconds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions