Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main: improve test flag handling #3151

Merged
merged 1 commit into from
Jun 29, 2023
Merged

main: improve test flag handling #3151

merged 1 commit into from
Jun 29, 2023

Commits on Jun 29, 2023

  1. main: improve test flag handling

    A TestMain func is added to parse the test executable's flags.  Before running
    all tests, any flags that it did not parse (in particular, those following a
    double hyphen (--) which the flag package will stop parsing after) are retained
    in the modified os.Args value.  This allows the tests that exercise go-flags
    options to test these options with any user-provided flags prepended.
    
    One such use case for this fix is to change the default appdata directory that
    tests will use, which allows tests to succeed when the default home directory is
    read only.  For example:
    
    go test . -args -- --appdata=/some/other/appdata
    
    This well cause the go-flags tests to perform their tests with their own options
    being tested following the appdata change.
    jrick committed Jun 29, 2023
    Configuration menu
    Copy the full SHA
    e6e13a8 View commit details
    Browse the repository at this point in the history