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

testscript: add ${/} as a companion to ${:} #90

Merged
merged 1 commit into from May 6, 2020

Conversation

mvdan
Copy link
Collaborator

@mvdan mvdan commented Feb 23, 2020

${:} expands to os.PathListSeparator; now ${/} expands to
os.PathSeparator.

It's useful to skip windows-vs-unixy conditions, like the ones that we
simplified in exec_path_change with HOME and PATH.

It's also useful so that 'cmpenv stdout stdout.golden' can easily
support output which contains relative file paths.

While at it, make the stdin and exec_path_change scripts work on Wine
(i.e. vanilla Windows), which has neither Go nor coreutils installed.

${:} expands to os.PathListSeparator; now ${/} expands to
os.PathSeparator.

It's useful to skip windows-vs-unixy conditions, like the ones that we
simplified in exec_path_change with HOME and PATH.

It's also useful so that 'cmpenv stdout stdout.golden' can easily
support output which contains relative file paths.

While at it, make the stdin and exec_path_change scripts work on Wine
(i.e. vanilla Windows), which has neither Go nor coreutils installed.
Copy link
Collaborator

@myitcv myitcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - should probably have @rogpeppe also take a look.

@bcmills
Copy link

bcmills commented Mar 2, 2020

FWIW, in the cmd/go tests we tend to just do a regexp match on [/\\] (the “tent operator”) instead.

That admittedly does not work for cmpenv, though.

@mvdan
Copy link
Collaborator Author

mvdan commented Mar 2, 2020

Yep, this is precisely to support cmpenv. There is no way to compare stdout to a stdout.golden file via regular expressions. I could do it with stdout pattern..., but then I can only check for single lines, and not a command's entire output all at once.

@rogpeppe rogpeppe merged commit a7f0f53 into rogpeppe:master May 6, 2020
@mvdan mvdan deleted the env-path-separator branch August 30, 2020 09:49
fhs added a commit to fhs/go-internal that referenced this pull request Nov 18, 2020
Plan 9 environment variables names can't have slash in them.
Removing this is not a big loss considering it's not available in
`cmd/go` testscripts and it's also not documented.

Update rogpeppe#90
fhs added a commit to fhs/go-internal that referenced this pull request Nov 22, 2020
We're changing the name because ${/} doesn't work on Plan 9.
Plan 9 environment variables are stored as files in `/env`,
so they can't have slash in them.

Update rogpeppe#90
fhs added a commit to fhs/go-internal that referenced this pull request Nov 22, 2020
We're changing the name because ${/} doesn't work on Plan 9.
Plan 9 environment variables are stored as files in `/env`,
so they can't have slash in them.

Update rogpeppe#90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants