mirror of
https://gcc.gnu.org/git/gcc.git
synced 2026-02-22 03:46:53 -05:00
mime: remove test ordering dependency
Backport CL 421442 from upstream. Original description: Arrange for tests that call setMimeInit to fully restore the old values, by clearing the sync.Once that controls initialization. Once we've done that, call initMime in initMimeUnixTest because otherwise the test types loaded there will be cleared by the call to initMime that previously was not being done. For golang/go#51648 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/483117
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
63ba7dd52f2cc49dab4b70ac81309296a920d4dc
|
||||
0411a2733fd468e69f1998edd91e8fe3ba40ff9e
|
||||
|
||||
The first line of this file holds the git revision number of the last
|
||||
merge done from the gofrontend repository.
|
||||
|
||||
@@ -14,7 +14,10 @@ import (
|
||||
func setMimeInit(fn func()) (cleanup func()) {
|
||||
once = sync.Once{}
|
||||
testInitMime = fn
|
||||
return func() { testInitMime = nil }
|
||||
return func() {
|
||||
testInitMime = nil
|
||||
once = sync.Once{}
|
||||
}
|
||||
}
|
||||
|
||||
func clearMimeTypes() {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func initMimeUnixTest(t *testing.T) {
|
||||
once.Do(initMime)
|
||||
err := loadMimeGlobsFile("testdata/test.types.globs2")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user