-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: chenk <hen.keinan@gmail.com>
- Loading branch information
1 parent
e939169
commit 834b894
Showing
2 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package scanner | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_FilenameWindowsFriendly(t *testing.T) { | ||
|
||
tests := []struct { | ||
name string | ||
fileName string | ||
want string | ||
}{ | ||
{ | ||
name: "name with invalid char - colon", | ||
fileName: `kube-system-Role-system:controller:bootstrap-signer-2934213283.yaml`, | ||
want: `kube-system-Role-system_controller_bootstrap-signer-2934213283.yaml`, | ||
}, | ||
{ | ||
name: "name with no invalid chars", | ||
fileName: `kube-system-Role-system-controller-bootstrap-signer-2934213283.yaml`, | ||
want: `kube-system-Role-system-controller-bootstrap-signer-2934213283.yaml`, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
got := filenameWindowsFriendly(test.fileName) | ||
assert.Equal(t, test.want, got) | ||
}) | ||
} | ||
} |