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

testing/fstest: Glob generation fails on minus in directory name #44474

Closed
cugu opened this issue Feb 21, 2021 · 1 comment
Closed

testing/fstest: Glob generation fails on minus in directory name #44474

cugu opened this issue Feb 21, 2021 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@cugu
Copy link

cugu commented Feb 21, 2021

fstest.TestFS generates a glob pattern (testfs.go#L294), but generates an incorrect one when the directory contains a minus.

What version of Go are you using (go version)?

$ go version
go version go1.16 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

What did you do?

func TestFS(t *testing.T) {
	fsys := fstest.MapFS{
		"a-b/a": &fstest.MapFile{},
	}
	if err := fstest.TestFS(fsys, "a-b/a"); err != nil {
		t.Error(err)
	}
}
go test ./...

What did you expect to see?

ok  	github.com/foo/bar	4.953s

What did you see instead?

go test ./...
--- FAIL: TestFS (0.00s)
    fs_test.go:16: TestFS found errors:
        a-b: Glob(`a[-][b-b]/*a*`): syntax error in pattern
FAIL
FAIL	github.com/foo/bar	4.052s
FAIL

CC @rsc

@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 21, 2021
@ianlancetaylor ianlancetaylor added this to the Go1.17 milestone Feb 21, 2021
@gopherbot
Copy link

Change https://golang.org/cl/294869 mentions this issue: testing/fstest: treat dash specially when building glob

@golang golang locked and limited conversation to collaborators Feb 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants