Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quasar-network
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Nolte
quasar-network
Commits
26d8c130
Commit
26d8c130
authored
4 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Merge example api definition into test case
parent
dd102eb9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
qrpc.cabal
+0
-1
0 additions, 1 deletion
qrpc.cabal
test/Network/RpcSpec.hs
+24
-5
24 additions, 5 deletions
test/Network/RpcSpec.hs
test/Network/RpcSpec/ExampleApi.hs
+0
-29
0 additions, 29 deletions
test/Network/RpcSpec/ExampleApi.hs
with
24 additions
and
35 deletions
qrpc.cabal
+
0
−
1
View file @
26d8c130
...
...
@@ -77,6 +77,5 @@ test-suite qrpc-test
main-is: Spec.hs
other-modules:
Network.RpcSpec
Network.RpcSpec.ExampleApi
hs-source-dirs:
test
This diff is collapsed.
Click to expand it.
test/Network/RpcSpec.hs
+
24
−
5
View file @
26d8c130
...
...
@@ -6,12 +6,31 @@ module Network.RpcSpec where
import
Prelude
import
Network.Rpc
import
Test.Hspec
import
Network.RpcSpec.ExampleApi
$
(
makeProtocol
exampleApi
)
$
(
makeClient
exampleApi
)
$
(
makeServer
exampleApi
)
$
(
do
let
api
=
rpcApi
"Example"
[
rpcFunction
"fixedHandler42"
$
do
addArgument
"arg"
[
t
|
Int
|]
addResult
"result"
[
t
|
Bool
|]
setFixedHandler
[
|
return
.
(
==
42
)
|
],
rpcFunction
"fixedHandlerInc"
$
do
addArgument
"arg"
[
t
|
Int
|]
addResult
"result"
[
t
|
Int
|]
setFixedHandler
[
|
return
.
(
+
1
)
|
],
rpcFunction
"multiArgs"
$
do
addArgument
"one"
[
t
|
Int
|]
addArgument
"two"
[
t
|
Int
|]
addArgument
"three"
[
t
|
Bool
|]
addResult
"result"
[
t
|
Int
|]
addResult
"result2"
[
t
|
Bool
|]
,
rpcFunction
"noArgs"
$
do
addResult
"result"
[
t
|
Int
|]
,
rpcFunction
"noResponse"
$
do
addArgument
"arg"
[
t
|
Int
|]
,
rpcFunction
"noNothing"
$
return
()
]
mconcat
<$>
sequence
[
makeProtocol
api
,
makeClient
api
,
makeServer
api
]
)
exampleProtocolImpl
::
ExampleProtocolImpl
exampleProtocolImpl
=
ExampleProtocolImpl
{
...
...
This diff is collapsed.
Click to expand it.
test/Network/RpcSpec/ExampleApi.hs
deleted
100644 → 0
+
0
−
29
View file @
dd102eb9
module
Network.RpcSpec.ExampleApi
where
import
Prelude
import
Network.Rpc
data
Something
=
Something
exampleApi
::
RpcApi
exampleApi
=
rpcApi
"Example"
[
rpcFunction
"fixedHandler42"
$
do
addArgument
"arg"
[
t
|
Int
|]
addResult
"result"
[
t
|
Bool
|]
setFixedHandler
[
|
return
.
(
==
42
)
|
],
rpcFunction
"fixedHandlerInc"
$
do
addArgument
"arg"
[
t
|
Int
|]
addResult
"result"
[
t
|
Int
|]
setFixedHandler
[
|
return
.
(
+
1
)
|
],
rpcFunction
"multiArgs"
$
do
addArgument
"one"
[
t
|
Int
|]
addArgument
"two"
[
t
|
Int
|]
addArgument
"three"
[
t
|
Bool
|]
addResult
"result"
[
t
|
Int
|]
addResult
"result2"
[
t
|
Bool
|]
,
rpcFunction
"noArgs"
$
do
addResult
"result"
[
t
|
Int
|]
,
rpcFunction
"noResponse"
$
do
addArgument
"arg"
[
t
|
Int
|]
,
rpcFunction
"noNothing"
$
return
()
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment