]> Cypherpunks.ru repositories - gostls13.git/commit
testing/fstest: fix the Glob test when dir entries are out of order
authorAchille Roussel <achille.roussel@gmail.com>
Wed, 14 Jun 2023 04:39:54 +0000 (21:39 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 16 Jun 2023 18:21:40 +0000 (18:21 +0000)
commit6dc2d2aa6b9cbab9dc190276cb5a77b4b4a91cd3
tree50d8376dfba12bf69bace81ecdfb8bf2c57efe51
parent2b0ff4b629cc86139e719b92e5fc94950c19b5c7
testing/fstest: fix the Glob test when dir entries are out of order

This change adds a test highlighting an issue with the fstest.TestFS
test suite which occurred when the fs.FS implementation would expose
directories returning unordered directory entries from their ReadDir
method.

--- FAIL: TestShuffledFS (0.00s)
    testfs_test.go:76: testing fs.Sub(fsys, tmp): TestFS found errors:
        .: Glob(`*e*`): wrong output:
        extra: one
        missing: one

The issue came from having the wrong variable passed to the checkGlob
method. There are two variables named list and list2, the latter is
sorted, and the checkGlob method expects a sorted list but was passed
list instead of list2.

Change-Id: I5e49dccf14077e7d1fee51687eb6a5eeb0330c16
Reviewed-on: https://go-review.googlesource.com/c/go/+/503175
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
src/testing/fstest/testfs.go
src/testing/fstest/testfs_test.go