Test ensuring shortrefs are unique for edgecase (#1105)
## Description Some paths can generate identical unescaped strings even though they have different elements. Add a test ensuring they generate unique ShortRefs even under these conditions. ## Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [x] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) * closes #1092 ## Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
0b65b20200
commit
ec916bc1b3
@ -414,6 +414,18 @@ func (suite *PathUnitSuite) TestShortRefIsUnique() {
|
||||
assert.NotEqual(suite.T(), pb1.ShortRef(), pb2.ShortRef())
|
||||
}
|
||||
|
||||
// TestShortRefUniqueWithEscaping tests that two paths that output the same
|
||||
// unescaped string but different escaped strings have different shortrefs. This
|
||||
// situation can occur when one path has embedded path separators while the
|
||||
// other does not but contains the same characters.
|
||||
func (suite *PathUnitSuite) TestShortRefUniqueWithEscaping() {
|
||||
pb1 := Builder{}.Append(`this`, `is`, `a`, `path`)
|
||||
pb2 := Builder{}.Append(`this`, `is/a`, `path`)
|
||||
|
||||
require.NotEqual(suite.T(), pb1, pb2)
|
||||
assert.NotEqual(suite.T(), pb1.ShortRef(), pb2.ShortRef())
|
||||
}
|
||||
|
||||
func (suite *PathUnitSuite) TestFromStringErrors() {
|
||||
table := []struct {
|
||||
name string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user