mirror of
https://github.com/CrystalSplitter/ghcitui.git
synced 2024-11-29 02:54:21 +03:00
Reorganise ParseContextSpec fixtures
This commit is contained in:
parent
676396079a
commit
b1ef23191e
@ -11,14 +11,18 @@ import qualified Ghcitui.Loc as Loc
|
|||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec = do
|
spec = do
|
||||||
describe "parseContext" $ do
|
describe "parseContext" $ do
|
||||||
|
it "can parse fibonacci context" $ do
|
||||||
|
let expectedLoc =
|
||||||
|
Loc.SourceRange
|
||||||
|
{ Loc.startLine = Just 9
|
||||||
|
, Loc.startCol = Just 17
|
||||||
|
, Loc.endLine = Just 9
|
||||||
|
, Loc.endCol = Just 29
|
||||||
|
}
|
||||||
|
let expected =
|
||||||
|
PC.PCContext (PC.ParseContextOut "Yib.fibty.right" "test/Fib.hs" expectedLoc)
|
||||||
|
PC.parseContext fibFixture `shouldBe` expected
|
||||||
it "can parse the Ormolu function parseModule' (with an apostraphe)" $ do
|
it "can parse the Ormolu function parseModule' (with an apostraphe)" $ do
|
||||||
let apostrapheFixture =
|
|
||||||
T.unlines
|
|
||||||
[ "()"
|
|
||||||
, "[src/Ormolu.hs:(257,51)-(261,35)] #~GHCID-START~#()"
|
|
||||||
, "[src/Ormolu.hs:(257,51)-(261,35)] #~GHCID-START~#--> invoke"
|
|
||||||
, " Stopped in Ormolu.parseModule', src/Ormolu.hs:(257,51)-(261,35)"
|
|
||||||
]
|
|
||||||
let expectedLoc =
|
let expectedLoc =
|
||||||
Loc.SourceRange
|
Loc.SourceRange
|
||||||
{ Loc.startLine = Just 257
|
{ Loc.startLine = Just 257
|
||||||
@ -30,3 +34,20 @@ spec = do
|
|||||||
PC.PCContext
|
PC.PCContext
|
||||||
(PC.ParseContextOut "Ormolu.parseModule'" "src/Ormolu.hs" expectedLoc)
|
(PC.ParseContextOut "Ormolu.parseModule'" "src/Ormolu.hs" expectedLoc)
|
||||||
PC.parseContext apostrapheFixture `shouldBe` expected
|
PC.parseContext apostrapheFixture `shouldBe` expected
|
||||||
|
|
||||||
|
|
||||||
|
fibFixture :: T.Text
|
||||||
|
fibFixture =
|
||||||
|
T.unlines
|
||||||
|
[ "[test/Fib.hs:9:17-29] #~GHCID-START~#[test/Fib.hs:9:17-29] #~GHCID-START~#--> fibty 10"
|
||||||
|
, " Stopped in Yib.fibty.right, test/Fib.hs:9:17-29"
|
||||||
|
]
|
||||||
|
|
||||||
|
apostrapheFixture :: T.Text
|
||||||
|
apostrapheFixture =
|
||||||
|
T.unlines
|
||||||
|
[ "()"
|
||||||
|
, "[src/Ormolu.hs:(257,51)-(261,35)] #~GHCID-START~#()"
|
||||||
|
, "[src/Ormolu.hs:(257,51)-(261,35)] #~GHCID-START~#--> invoke"
|
||||||
|
, " Stopped in Ormolu.parseModule', src/Ormolu.hs:(257,51)-(261,35)"
|
||||||
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user