Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
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
gargantext
gargantext-ihaskell
Commits
518e1970
Commit
518e1970
authored
Jan 06, 2014
by
Eyal Dechter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed compeletePath tests.
parent
fd2a2ef2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
14 deletions
+22
-14
Hspec.hs
src/Hspec.hs
+22
-14
No files found.
src/Hspec.hs
View file @
518e1970
...
...
@@ -75,10 +75,10 @@ completes string expected = completionTarget newString cursorloc `shouldBe` expe
Nothing
->
error
"Expected cursor written as '!'."
Just
idx
->
(
replace
"!"
""
string
,
idx
)
completionHas_
action
string
expected
=
do
completionHas_
wrap
string
expected
=
do
(
matched
,
completions
)
<-
doGhc
$
do
initCompleter
action
complete
newString
cursorloc
wrap
$
do
initCompleter
complete
newString
cursorloc
let
existsInCompletion
=
(`
elem
`
completions
)
unmatched
=
filter
(
not
.
existsInCompletion
)
expected
unmatched
`
shouldBe
`
[]
...
...
@@ -86,10 +86,12 @@ completionHas_ action string expected = do
Nothing
->
error
"Expected cursor written as '!'."
Just
idx
->
(
replace
"!"
""
string
,
idx
)
completionHas
=
completionHas_
(
return
()
)
completionHas
=
completionHas_
id
initCompleter
::
GhcMonad
m
=>
m
a
->
m
a
initCompleter
action
=
do
initCompleter
::
GhcMonad
m
=>
m
()
initCompleter
=
do
pwd
<-
Eval
.
liftIO
$
getCurrentDirectory
--Eval.liftIO $ traceIO $ pwd
flags
<-
getSessionDynFlags
setSessionDynFlags
$
flags
{
hscTarget
=
HscInterpreted
,
ghcLink
=
LinkInMemory
}
...
...
@@ -99,7 +101,6 @@ initCompleter action = do
"import qualified Data.List as List"
,
"import Data.Maybe as Maybe"
]
setContext
$
map
IIDecl
imports
action
withHsDirectory
::
(
FilePath
->
Sh
()
)
->
IO
()
withHsDirectory
f
=
shelly
$
withTmpDir
$
\
dirPath
->
...
...
@@ -141,7 +142,7 @@ completionTests = do
completionType
"A.x"
[
"A"
,
"x"
]
`
shouldBe
`
Qualified
"A"
"x"
completionType
"a.x"
[
"a"
,
"x"
]
`
shouldBe
`
Identifier
"x"
completionType
"pri"
[
"pri"
]
`
shouldBe
`
Identifier
"pri"
completionType
":load A"
[
""
]
`
shouldBe
`
HsFilePath
"A"
completionType
":load A"
[
"
A
"
]
`
shouldBe
`
HsFilePath
"A"
it
"properly completes identifiers"
$
do
"pri!"
`
completionHas
`
[
"print"
]
...
...
@@ -166,16 +167,23 @@ completionTests = do
withHsDirectory
$
\
dirPath
->
let
loading
xs
=
":load "
++
encodeString
xs
paths
xs
=
map
encodeString
xs
completionHas'
=
completionHas_
$
do
Eval
.
evaluate
defaultKernelState
(
":! cd "
++
dirPath
)
(
\
b
d
->
return
()
)
completionHas'
=
completionHas_
fun
fun
action
=
do
pwd
<-
Eval
.
liftIO
getCurrentDirectory
Eval
.
evaluate
defaultKernelState
(
":! cd "
++
dirPath
)
(
\
b
d
->
return
()
)
out
<-
action
Eval
.
evaluate
defaultKernelState
(
":! cd "
++
pwd
)
(
\
b
d
->
return
()
)
return
out
in
liftIO
$
do
loading
(
"dir"
</>
"file!"
)
`
completionHas'
`
paths
[
"dir"
</>
"file2.hs"
,
"dir"
</>
"file2.lhs"
]
loading
(
""
</>
"file1!"
)
`
completionHas'
`
paths
[
""
</>
"file1.hs"
,
""
</>
"file1.lhs"
]
""
</>
"file1.lhs"
]
loading
(
""
</>
"file1!"
)
`
completionHas'
`
paths
[
""
</>
"file1.hs"
,
""
</>
"file1.lhs"
]
evalTests
=
do
describe
"Code Evaluation"
$
do
...
...
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