Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit c1c40b4

Browse files
committed
WIP: Adding test cases
1 parent 5d2c155 commit c1c40b4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/functional/FormatSpec.hs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ spec = do
9292
liftIO $ edits `shouldBe` [TextEdit (Range (Position 1 0) (Position 3 0))
9393
"foo x y = do\n print x\n return 42\n"]
9494

95+
-- Work in progress
96+
describe "ormolu" $ do
97+
it "formats correctly" $ runSession hieCommand fullCaps "test/testdata" $ do
98+
doc <- openDoc "Format.hs" "haskell"
99+
formatDoc doc (FormattingOptions 2 True)
100+
documentContents doc >>= liftIO . (`shouldBe` formattedOrmolu)
101+
95102

96103
formattedDocTabSize2 :: T.Text
97104
formattedDocTabSize2 =
@@ -165,3 +172,16 @@ formattedBrittanyPostFloskell =
165172
\bar s = do\n\
166173
\ x <- return \"hello\"\n\
167174
\ return \"asdf\"\n\n"
175+
176+
formattedOrmolu :: T.Text
177+
formattedOrmolu =
178+
"module Format where\n\
179+
\\n\
180+
\foo :: Int -> Int\n\
181+
\foo 3 = 2\n\
182+
\foo x = x\n\
183+
\\n\
184+
\bar :: String -> IO String\n\
185+
\bar s = do\n\
186+
\ x <- return \"hello\"\n\
187+
\ return \"asdf\"\n"

0 commit comments

Comments
 (0)