Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/run-ormolu@v16
- uses: haskell-actions/run-ormolu@v17
build:
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ghc-version: ['9.10', '9.8', '9.6']
ghc-version: ['9.12', '9.10', '9.8', '9.6']

include:
- os: windows-latest
ghc-version: '9.8'
ghc-version: '9.12'
- os: macos-latest
ghc-version: '9.8'
ghc-version: '9.12'

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Build
run: cabal build all

- if: ${{ matrix.os == 'ubuntu-latest' && matrix.ghc-version == '9.8'}}
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.ghc-version == '9.12'}}
name: doctests
run: |
cabal run doctests
Expand Down
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
0.2.0
===

- switched to Diff for testing round-trips
- removed MarkupParse.Patch
- renamed MarkupParse.FlatParse to MarkupParse.Internal.FlatParse and removed unused exports. Added non-stable note.
- moved ParserWarn, runParser_ & runParserWarn to MarkupParse.
- changed diff executable to markupparse-diff.

0.1.1
===

Expand Down
127 changes: 0 additions & 127 deletions app/diff.hs

This file was deleted.

51 changes: 51 additions & 0 deletions app/markup-parse-diff.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-unused-top-binds #-}

module Main (main) where

import Control.Category ((>>>))
import Control.Monad
import Data.Algorithm.Diff
import Data.Algorithm.DiffOutput
import Data.Bifunctor
import Data.Bool
import Data.ByteString (ByteString)
import Data.ByteString qualified as B
import Data.ByteString.Char8 qualified as C
import Data.Function
import Data.Maybe
import MarkupParse
import Test.Tasty (TestTree, defaultMain, testGroup)
import Test.Tasty.Golden.Advanced (goldenTest)
import Prelude

main :: IO ()
main =
defaultMain $
testGroup
"tests"
[ goldenTests
]

goldenTests :: TestTree
goldenTests =
testGroup
"examples"
( testExample
<$> [ (Compact, Xml, "other/line.svg"),
(Compact, Html, "other/ex1.html")
]
)

testExample :: (RenderStyle, Standard, FilePath) -> TestTree
testExample (r, s, fp) =
goldenTest
fp
(B.readFile fp)
(isoMarkupMarkdown r s <$> B.readFile fp)
(\expected actual -> getDiff (C.lines expected) (C.lines actual) & fmap (bimap (C.unpack >>> pure) (C.unpack >>> pure)) & diffToLineRanges & prettyDiffs & (\xs -> bool (pure $ Just (show xs)) (pure Nothing) (xs == mempty)))
(\_ -> pure ())

-- round trip markdown >>> markup
isoMarkupMarkdown :: RenderStyle -> Standard -> ByteString -> ByteString
isoMarkupMarkdown r s m = m & (markup s >=> markdown r s) & warnError
26 changes: 11 additions & 15 deletions markup-parse.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: markup-parse
version: 0.1.1.1
version: 0.2.0.0
license: BSD-3-Clause
license-file: LICENSE
copyright: Copyright, Tony Day, 2023-
Expand All @@ -14,9 +14,10 @@ description:
A markup parser and printer, from and to strict bytestrings, optimised for speed.
build-type: Simple
tested-with:
, GHC == 9.10.1
, GHC == 9.6.5
, GHC == 9.8.2
, GHC == 9.6.7
, GHC == 9.8.4
, GHC == 9.10.2
, GHC == 9.12.2
extra-doc-files:
ChangeLog.md
other/*.html
Expand Down Expand Up @@ -52,41 +53,36 @@ library
build-depends:
, base >=4.14 && <5
, bytestring >=0.11.3 && <0.13
, containers >=0.6 && <0.8
, deepseq >=1.4.4 && <1.6
, containers >=0.6 && <0.9
, deepseq >=1.4 && <1.6
, flatparse >=0.3.5 && <0.6
, string-interpolate >=0.3 && <0.4
, tasty >=1.2 && <1.6
, tasty-golden >=2.3.1.1 && <2.4
, these >=1.1 && <1.3
, tree-diff >=0.3 && <0.4
exposed-modules:
MarkupParse
MarkupParse.FlatParse
MarkupParse.Patch
MarkupParse.Internal.FlatParse

test-suite doctests
import: ghc2021-stanza
main-is: doctests.hs
hs-source-dirs: test
build-depends:
, base >=4.14 && <5
, doctest-parallel >=0.3 && <0.4
, doctest-parallel >=0.3 && <0.5
ghc-options: -threaded
type: exitcode-stdio-1.0

test-suite markup-parse-diff
import: ghc-options-exe-stanza
import: ghc-options-stanza
import: ghc2021-stanza
main-is: diff.hs
main-is: markup-parse-diff.hs
hs-source-dirs: app
build-depends:
, base >=4.14 && <5
, bytestring >=0.11.3 && <0.13
, markup-parse
, string-interpolate >=0.3 && <0.4
, tasty >=1.2 && <1.6
, tasty-golden >=2.3.1.1 && <2.4
, tree-diff >=0.3 && <0.4
, Diff >=1.0 && <1.1
type: exitcode-stdio-1.0
Loading