37 lines
698 B
Go
37 lines
698 B
Go
package fileUtilities
|
|
|
|
import "testing"
|
|
|
|
func Test_replaceBackslashes(t *testing.T) {
|
|
type args struct {
|
|
input string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want string
|
|
}{
|
|
{
|
|
name: "replace backslashes",
|
|
args: args{
|
|
input: "C:\\Users\\james\\Documents\\test",
|
|
},
|
|
want: "C:/Users/james/Documents/test",
|
|
},
|
|
{
|
|
name: "no backslashes",
|
|
args: args{
|
|
input: "C:/Users/james/Documents/test",
|
|
},
|
|
want: "C:/Users/james/Documents/test",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := replaceBackslashes(tt.args.input); got != tt.want {
|
|
t.Errorf("replaceBackslashes() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|