Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ld
go-car
Commits
ffcc4b77
Commit
ffcc4b77
authored
Jul 21, 2021
by
Masih H. Derkani
Committed by
Masih H. Derkani
Jul 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error handing in tests
When error is not expected in tests, assert that there is indeed no error.
parent
396cc228
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
v2/index/index_test.go
v2/index/index_test.go
+1
-0
v2/index_gen_test.go
v2/index_gen_test.go
+8
-4
No files found.
v2/index/index_test.go
View file @
ffcc4b77
...
...
@@ -39,6 +39,7 @@ func TestNew(t *testing.T) {
if
tt
.
wantErr
{
require
.
Error
(
t
,
err
)
}
else
{
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
tt
.
want
,
got
)
}
})
...
...
v2/index_gen_test.go
View file @
ffcc4b77
...
...
@@ -98,9 +98,11 @@ func TestReadOrGenerateIndex(t *testing.T) {
got
,
err
:=
ReadOrGenerateIndex
(
carFile
,
tt
.
readOpts
...
)
if
tt
.
wantErr
{
require
.
Error
(
t
,
err
)
}
else
{
require
.
NoError
(
t
,
err
)
want
:=
tt
.
wantIndexer
(
t
)
require
.
Equal
(
t
,
want
,
got
)
}
want
:=
tt
.
wantIndexer
(
t
)
require
.
Equal
(
t
,
want
,
got
)
})
}
}
...
...
@@ -143,9 +145,11 @@ func TestGenerateIndexFromFile(t *testing.T) {
got
,
err
:=
GenerateIndexFromFile
(
tt
.
carPath
)
if
tt
.
wantErr
{
require
.
Error
(
t
,
err
)
}
else
{
require
.
NoError
(
t
,
err
)
want
:=
tt
.
wantIndexer
(
t
)
require
.
Equal
(
t
,
want
,
got
)
}
want
:=
tt
.
wantIndexer
(
t
)
require
.
Equal
(
t
,
want
,
got
)
})
}
}
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