Skip to content

Fix test suite to expect 4 spaces.#3

Merged
parsonsmatt merged 1 commit intofourmolu:masterfrom
georgefst:master
May 18, 2020
Merged

Fix test suite to expect 4 spaces.#3
parsonsmatt merged 1 commit intofourmolu:masterfrom
georgefst:master

Conversation

@georgefst
Copy link
Copy Markdown
Collaborator

(Almost) closes #1.

For reference, this is just the result of running:

#!/usr/bin/env cabal

{- cabal:
build-depends: base,turtle
-}

{-# LANGUAGE OverloadedStrings #-}

import Prelude hiding (FilePath)

import Control.Monad
import Data.Either (fromRight)
import Turtle ((<.>), (</>), FilePath)
import qualified Turtle
import Turtle.Pattern
import Turtle.Prelude
import Turtle.Shell


main = do

    -- remove all output files
    sh $ rm =<< find (suffix "-out.hs") examplesDir

    -- generate new ones
    sh $ do
        inF <- find (suffix ".hs") examplesDir
        let dir = Turtle.directory inF
            base = toText' $ Turtle.basename inF
            outF = dir </> (Turtle.fromText $ base <> "-out") <.> "hs"
        formatted <- snd <$> procStrict "fourmolu" [toText' inF] Turtle.empty
        liftIO $ writeTextFile outF formatted

    where
        toText' = fromRight (error "invalid path encoding") . Turtle.toText

examplesDir = "fourmolu/data/examples"

Although I'm sure this is a bash one liner for anyone so inclined, and to be honest, typed filepaths kind of just get in the way here.

@georgefst
Copy link
Copy Markdown
Collaborator Author

Indeed now that I think about it, it would have been easier to just hack the test script.

But anyway, really I just wanted to get my name on this project, which is to my mind the most important development in Haskell since monadic IO.

@parsonsmatt
Copy link
Copy Markdown
Collaborator

image

@parsonsmatt parsonsmatt merged commit 53401b9 into fourmolu:master May 18, 2020
@parsonsmatt
Copy link
Copy Markdown
Collaborator

@georgefst You want commit rights on the repo? 😄

@georgefst
Copy link
Copy Markdown
Collaborator Author

It would be an honour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix the test suite

2 participants