Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
92299b7c
Commit
92299b7c
authored
Nov 05, 2014
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New test coverage for ethutil/path.go
parent
b96a59eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
path_test.go
ethutil/path_test.go
+51
-0
No files found.
ethutil/path_test.go
0 → 100644
View file @
92299b7c
package
ethutil
import
(
// "os"
"testing"
)
func
TestGoodFile
(
t
*
testing
.
T
)
{
goodpath
:=
"~/goethereumtest.pass"
path
:=
ExpandHomePath
(
goodpath
)
contentstring
:=
"3.14159265358979323846"
err
:=
WriteFile
(
path
,
[]
byte
(
contentstring
))
if
err
!=
nil
{
t
.
Error
(
"Could not write file"
)
}
if
!
FileExist
(
path
)
{
t
.
Error
(
"File not found at"
,
path
)
}
v
,
err
:=
ReadAllFile
(
path
)
if
err
!=
nil
{
t
.
Error
(
"Could not read file"
,
path
)
}
if
v
!=
contentstring
{
t
.
Error
(
"Expected"
,
contentstring
,
"Got"
,
v
)
}
}
func
TestBadFile
(
t
*
testing
.
T
)
{
badpath
:=
"/this/path/should/not/exist/goethereumtest.fail"
path
:=
ExpandHomePath
(
badpath
)
contentstring
:=
"3.14159265358979323846"
err
:=
WriteFile
(
path
,
[]
byte
(
contentstring
))
if
err
==
nil
{
t
.
Error
(
"Wrote file, but should not be able to"
,
path
)
}
if
FileExist
(
path
)
{
t
.
Error
(
"Found file, but should not be able to"
,
path
)
}
v
,
err
:=
ReadAllFile
(
path
)
if
err
==
nil
{
t
.
Error
(
"Read file, but should not be able to"
,
v
)
}
}
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