Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
2184137c
Commit
2184137c
authored
Mar 07, 2012
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
path/filepath/path_test.go: repair and enable TestAbs
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/5759051
parent
73b8ccb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
19 deletions
+47
-19
src/pkg/path/filepath/path_test.go
src/pkg/path/filepath/path_test.go
+47
-19
No files found.
src/pkg/path/filepath/path_test.go
View file @
2184137c
...
...
@@ -642,33 +642,61 @@ func TestEvalSymlinks(t *testing.T) {
}
}
// Test paths relative to $GOROOT/src
var
abstests
=
[]
string
{
"../AUTHORS"
,
"pkg/../../AUTHORS"
,
"Make.inc"
,
"pkg/math"
,
// Test directories relative to temporary directory.
// The tests are run in absTestDirs[0].
var
absTestDirs
=
[]
string
{
"a"
,
"a/b"
,
"a/b/c"
,
}
// Test paths relative to temporary directory. $ expands to the directory.
// The tests are run in absTestDirs[0].
// We create absTestDirs first.
var
absTests
=
[]
string
{
"."
,
"$GOROOT/src/Make.inc"
,
"$GOROOT/src/../src/Make.inc"
,
"$GOROOT/misc/cgo"
,
"$GOROOT"
,
"b"
,
"../a"
,
"../a/b"
,
"../a/b/./c/../../.././a"
,
"$"
,
"$/."
,
"$/a/../a/b"
,
"$/a/b/c/../../.././a"
,
}
func
TestAbs
(
t
*
testing
.
T
)
{
t
.
Logf
(
"test needs to be rewritten; disabled"
)
return
oldwd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
t
.
Fatal
(
"Getwd failed: "
+
err
.
Error
()
)
t
.
Fatal
(
"Getwd failed: "
,
err
)
}
defer
os
.
Chdir
(
oldwd
)
goroot
:=
os
.
Getenv
(
"GOROOT"
)
cwd
:=
filepath
.
Join
(
goroot
,
"src"
)
os
.
Chdir
(
cwd
)
for
_
,
path
:=
range
abstests
{
path
=
strings
.
Replace
(
path
,
"$GOROOT"
,
goroot
,
-
1
)
root
,
err
:=
ioutil
.
TempDir
(
""
,
"TestAbs"
)
if
err
!=
nil
{
t
.
Fatal
(
"TempDir failed: "
,
err
)
}
defer
os
.
RemoveAll
(
root
)
err
=
os
.
Chdir
(
root
)
if
err
!=
nil
{
t
.
Fatal
(
"chdir failed: "
,
err
)
}
for
_
,
dir
:=
range
absTestDirs
{
err
=
os
.
Mkdir
(
dir
,
0777
)
if
err
!=
nil
{
t
.
Fatal
(
"Mkdir failed: "
,
err
)
}
}
err
=
os
.
Chdir
(
absTestDirs
[
0
])
if
err
!=
nil
{
t
.
Fatal
(
"chdir failed: "
,
err
)
}
for
_
,
path
:=
range
absTests
{
path
=
strings
.
Replace
(
path
,
"$"
,
root
,
-
1
)
info
,
err
:=
os
.
Stat
(
path
)
if
err
!=
nil
{
t
.
Errorf
(
"%s: %s"
,
path
,
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment