Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/Core/NewlineSpec.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Core.NewlineSpec (spec) where

import JbeamEdit.Core.Newline (detectNewline)

Check failure on line 3 in test/Core/NewlineSpec.hs

View workflow job for this annotation

GitHub Actions / Build for release for 9.14.1 (experimental)

Could not find module ‘JbeamEdit.Core.Newline’.

Check failure on line 3 in test/Core/NewlineSpec.hs

View workflow job for this annotation

GitHub Actions / Build for release for 9.14.1 (stable)

Could not find module ‘JbeamEdit.Core.Newline’.
import System.IO (Newline (..))
import Test.Hspec

spec :: Spec
spec =
describe "detectNewline" $ do
it "detects LF for unix line endings" $
detectNewline "a\nb\n" `shouldBe` LF
it "detects CRLF for windows line endings" $
detectNewline "a\r\nb\r\n" `shouldBe` CRLF
it "detects CRLF when line endings are mixed" $
detectNewline "a\r\nb\n" `shouldBe` CRLF
it "defaults to LF when there is no line ending" $
detectNewline "abc" `shouldBe` LF
Loading