Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
myOwnPad
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dario
myOwnPad
Commits
ba03d4f3
Commit
ba03d4f3
authored
9 years ago
by
dario
Browse files
Options
Downloads
Patches
Plain Diff
tests: add
parent
4da723e3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
myOwnPad.cabal
+12
-0
12 additions, 0 deletions
myOwnPad.cabal
tests/Pad/Tests.hs
+49
-0
49 additions, 0 deletions
tests/Pad/Tests.hs
with
61 additions
and
0 deletions
myOwnPad.cabal
+
12
−
0
View file @
ba03d4f3
...
...
@@ -58,3 +58,15 @@ executable myOwnPad-client
build-depends:
base >= 4 && <= 5
, myOwnPad
test-suite myOwnPad-tests
type: detailed-0.9
hs-source-dirs: tests
test-module: Pad.Tests
default-language: Haskell2010
build-depends:
base
, Cabal >= 1.9.2
, myOwnPad
, attoparsec
, blaze-builder
This diff is collapsed.
Click to expand it.
tests/Pad/Tests.hs
0 → 100644
+
49
−
0
View file @
ba03d4f3
{-# LANGUAGE OverloadedStrings #-}
module
Pad.Tests
where
-- a lot of copy-paste from
-- https://www.haskell.org/cabal/users-guide/developing-packages.html#test-suites
import
Distribution.TestSuite
import
Blaze.ByteString.Builder
import
qualified
Data.Attoparsec.ByteString
as
APS
import
Pad.PadMessage
import
Pad.ChangeSet
import
Pad.NetProtocol
import
Pad.NetProtocol.Parse
import
Pad.NetProtocol.Instances
tests
::
IO
[
Test
]
tests
=
return
$
map
(
Test
.
uncurry
serialize_parse_id
)
$
flip
zip
[
1
..
]
$
[
AddText
(
Pos
25
)
"hello"
,
AddText
(
Pos
999999999999999
)
""
,
RemoveText
(
Pos
42
)
(
Len
5
)
,
SetAttribute
(
Pos
5
)
(
Len
10
)
(
AttrAuthorId
(
AuthorId
"a.foo"
))
,
ClearAttribute
(
Pos
0
)
(
Len
1
)
(
AttrFontBold
)
]
++
[
]
where
serialize_parse_id
change
n
=
TestInstance
{
run
=
do
let
nc
=
toByteString
$
netProtoShow
change
ch'
=
APS
.
parseOnly
parseChange
nc
print
change
print
nc
print
ch'
return
$
case
ch'
of
Left
err
->
Finished
$
Error
err
Right
c
|
change
==
c
->
Finished
Pass
Right
c
|
otherwise
->
Finished
.
Fail
$
"expected "
++
(
show
change
)
++
", but was "
++
(
show
c
)
,
name
=
"serialize_parse_id"
++
(
show
n
)
,
tags
=
[]
,
options
=
[]
,
setOption
=
\
_
_
->
Right
(
serialize_parse_id
change
n
)
}
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