586ed1b58d
* Initial Layout * Commit to test File Handling OS independed * Hide struct properties to prevent manual interaction * Fix Linting Errors * 1st Working Windows Version * Add missing Error Handling * Fix Linting Errors * Remove dependencies * Further Improvements * Remove commented code * Improve comments and error messages * No pointers to FPath * Improve comment * Do not filepath.ToSlash URL path * Extract helper functions for parsing local path and Storj path * Minor Improvements based on PR Comments * Fix Linting Error and make Regex private * Improve Layout * Rework FPath and add tests * Add more tests cases for windows * Use for-loop instead of goto * Use FPath in all uplink commands * Add guard checks * Add Test Cases and add comments
45 lines
623 B
Go
45 lines
623 B
Go
// Copyright (C) 2018 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
// +build linux darwin
|
|
|
|
package fpath
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestLocalPathUnix(t *testing.T) {
|
|
for i, tt := range []struct {
|
|
url string
|
|
base string
|
|
}{
|
|
{
|
|
url: "/",
|
|
base: "/",
|
|
},
|
|
{
|
|
url: "//",
|
|
base: "/",
|
|
},
|
|
{
|
|
url: "/home/user/folder",
|
|
base: "folder",
|
|
},
|
|
{
|
|
url: "/home/user/folder/",
|
|
base: "folder",
|
|
},
|
|
{
|
|
url: "/home/user/folder/file.sh",
|
|
base: "file.sh",
|
|
},
|
|
{
|
|
url: "//home//user//folder//file.sh",
|
|
base: "file.sh",
|
|
},
|
|
} {
|
|
testLocalPath(t, tt.url, tt.base, i)
|
|
}
|
|
}
|