Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
exchain
nebula
Commits
7ee7e287
Commit
7ee7e287
authored
Apr 20, 2023
by
inphi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Hints CB test
parent
e7562f4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
15 deletions
+25
-15
hints_test.go
op-program/preimage/hints_test.go
+25
-15
No files found.
op-program/preimage/hints_test.go
View file @
7ee7e287
...
@@ -87,20 +87,30 @@ func TestHints(t *testing.T) {
...
@@ -87,20 +87,30 @@ func TestHints(t *testing.T) {
require
.
ErrorIs
(
t
,
err
,
io
.
ErrUnexpectedEOF
)
require
.
ErrorIs
(
t
,
err
,
io
.
ErrUnexpectedEOF
)
})
})
t
.
Run
(
"cb error"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"cb error"
,
func
(
t
*
testing
.
T
)
{
var
buf
bytes
.
Buffer
a
,
b
:=
bidirectionalPipe
()
hw
:=
NewHintWriter
(
&
buf
)
var
wg
sync
.
WaitGroup
hw
.
Hint
(
rawHint
(
"one"
))
wg
.
Add
(
2
)
hw
.
Hint
(
rawHint
(
"two"
))
hr
:=
NewHintReader
(
&
buf
)
go
func
()
{
cbErr
:=
errors
.
New
(
"fail"
)
hw
:=
NewHintWriter
(
a
)
err
:=
hr
.
NextHint
(
func
(
hint
string
)
error
{
return
cbErr
})
hw
.
Hint
(
rawHint
(
"one"
))
require
.
ErrorIs
(
t
,
err
,
cbErr
)
hw
.
Hint
(
rawHint
(
"two"
))
var
readHint
string
wg
.
Done
()
err
=
hr
.
NextHint
(
func
(
hint
string
)
error
{
}()
readHint
=
hint
go
func
()
{
return
nil
defer
wg
.
Done
()
})
hr
:=
NewHintReader
(
b
)
require
.
NoError
(
t
,
err
)
cbErr
:=
errors
.
New
(
"fail"
)
require
.
Equal
(
t
,
readHint
,
"two"
)
err
:=
hr
.
NextHint
(
func
(
hint
string
)
error
{
return
cbErr
})
require
.
ErrorIs
(
t
,
err
,
cbErr
)
var
readHint
string
err
=
hr
.
NextHint
(
func
(
hint
string
)
error
{
readHint
=
hint
return
nil
})
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
readHint
,
"two"
)
}()
wg
.
Wait
()
})
})
}
}
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