haskell-tools-cli 0.7.0.0 → 0.8.0.0
raw patch · 21 files changed
+215/−103 lines, 21 filesdep ~criteriondep ~haskell-tools-astdep ~haskell-tools-cliPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: criterion, haskell-tools-ast, haskell-tools-cli, haskell-tools-prettyprint, haskell-tools-refactor
API changes (from Hackage documentation)
- Language.Haskell.Tools.Refactor.CLI: instance Language.Haskell.Tools.Refactor.Session.IsRefactSessionState Language.Haskell.Tools.Refactor.CLI.CLISessionState
+ Language.Haskell.Tools.Refactor.CLI: instance Language.Haskell.Tools.Refactor.RefactorBase.IsRefactSessionState Language.Haskell.Tools.Refactor.CLI.CLISessionState
+ Paths_haskell_tools_cli: getBinDir :: IO FilePath
+ Paths_haskell_tools_cli: getDataDir :: IO FilePath
+ Paths_haskell_tools_cli: getDataFileName :: FilePath -> IO FilePath
+ Paths_haskell_tools_cli: getLibDir :: IO FilePath
+ Paths_haskell_tools_cli: getLibexecDir :: IO FilePath
+ Paths_haskell_tools_cli: getSysconfDir :: IO FilePath
+ Paths_haskell_tools_cli: version :: Version
Files
- Language/Haskell/Tools/Refactor/CLI.hs +24/−18
- examples/Project/multi-packages-same-module/package1/A.hs +0/−3
- examples/Project/multi-packages-same-module/package1/package1.cabal +0/−18
- examples/Project/multi-packages-same-module/package2/A.hs +0/−1
- examples/Project/multi-packages-same-module/package2/package2.cabal +0/−18
- examples/Project/with-main-renamed/A.hs +3/−0
- examples/Project/with-main-renamed/some-test-package.cabal +18/−0
- examples/Project/with-main/Main.hs +3/−0
- examples/Project/with-main/some-test-package.cabal +18/−0
- examples/Project/with-multi-main/A.hs +5/−0
- examples/Project/with-multi-main/B.hs +3/−0
- examples/Project/with-multi-main/Main.hs +3/−0
- examples/Project/with-multi-main/some-test-package.cabal +24/−0
- examples/Project/with-other-executable/A.hs +3/−0
- examples/Project/with-other-executable/some-test-package.cabal +19/−0
- examples/Project/working-dir/data.txt +0/−0
- examples/Project/working-dir/some-test-package.cabal +19/−0
- examples/Project/working-dir/src/A.hs +7/−0
- haskell-tools-cli.cabal +20/−12
- test-stackage/Main.hs +15/−12
- test/Main.hs +31/−21
Language/Haskell/Tools/Refactor/CLI.hs view
@@ -18,6 +18,8 @@ import System.Directory import System.Exit import System.IO +import System.FilePath +import Data.Version (showVersion) import DynFlags as GHC import ErrUtils @@ -28,10 +30,11 @@ import Packages import Language.Haskell.Tools.PrettyPrint -import Language.Haskell.Tools.Refactor +import Language.Haskell.Tools.Refactor as HT import Language.Haskell.Tools.Refactor.GetModules import Language.Haskell.Tools.Refactor.Perform import Language.Haskell.Tools.Refactor.Session +import Paths_haskell_tools_cli (version) type CLIRefactorSession = StateT CLISessionState Ghc @@ -52,6 +55,8 @@ , "src/ast", "src/backend-ghc", "src/prettyprint", "src/rewrite", "src/refactor"] refactorSession :: Handle -> Handle -> [String] -> IO Bool +refactorSession _ _ args | "-v" `elem` args = do putStrLn $ showVersion version + return True refactorSession input output args = runGhc (Just libdir) $ handleSourceError printSrcErrors $ flip evalStateT initSession $ do lift $ initGhcFlags @@ -73,13 +78,7 @@ liftIO $ hPutStrLn output "Compiling modules. This may take some time. Please wait." res <- loadPackagesFrom (\ms -> liftIO $ hPutStrLn output ("Loaded module: " ++ modSumName ms)) (const $ return ()) (\_ _ -> return []) workingDirs case res of - Right (_, ignoredMods) -> do - when (not $ null ignoredMods) - $ liftIO $ hPutStrLn output - $ "The following modules are ignored: " - ++ concat (intersperse ", " $ ignoredMods) - ++ ". Multiple modules with the same qualified name are not supported." - + Right _ -> do liftIO . hPutStrLn output $ if ("-one-shot" `elem` flags) then "All modules loaded." else "All modules loaded. Use 'SelectModule module-name' to select a module." @@ -143,9 +142,14 @@ performSessionCommand :: Handle -> RefactorSessionCommand -> CLIRefactorSession [SourceFileKey] performSessionCommand output (LoadModule modName) = do - mod <- gets (lookupModInSCs (SourceFileKey NormalHs modName) . (^. refSessMCs)) - if isJust mod then modify $ actualMod .= fmap fst mod - else liftIO $ hPutStrLn output ("Cannot find module: " ++ modName) + files <- HT.findModule modName + mcs <- gets (^. refSessMCs) + case nub files of + [] -> liftIO $ hPutStrLn output ("Cannot find module: " ++ modName) + [fileName] -> do + mod <- gets (lookupModInSCs (SourceFileKey fileName modName) . (^. refSessMCs)) + modify $ actualMod .= fmap fst mod + _ -> liftIO $ hPutStrLn output ("Ambiguous module: " ++ modName ++ " found: " ++ show files ++ " " ++ show mcs) return [] performSessionCommand _ Skip = return [] performSessionCommand _ Exit = do modify $ exiting .= True @@ -163,27 +167,27 @@ return [] Right resMods -> performChanges output inDryMode resMods - where performChanges output False resMods = + where performChanges :: HasModuleInfo dom => Handle -> Bool -> [RefactorChange dom] -> CLIRefactorSession [SourceFileKey] + performChanges output False resMods = forM resMods $ \case ModuleCreated n m otherM -> do Just (_, otherMR) <- gets (lookupModInSCs otherM . (^. refSessMCs)) let Just otherMS = otherMR ^? modRecMS + otherSrcDir <- liftIO $ getSourceDir otherMS let loc = srcDirFromRoot otherSrcDir n liftIO $ withBinaryFile loc WriteMode $ \handle -> do hSetEncoding handle utf8 hPutStr handle (prettyPrint m) - return (SourceFileKey NormalHs n) + return (SourceFileKey n (sourceFileModule (loc `makeRelative` n))) ContentChanged (n,m) -> do - let modName = semanticsModule m - ms <- getModSummary modName (isBootModule $ m ^. semantics) - let file = fromJust $ ml_hs_file $ ms_location ms + let file = n ^. sfkFileName liftIO $ withBinaryFile file WriteMode $ \handle -> do hSetEncoding handle utf8 hPutStr handle (prettyPrint m) return n ModuleRemoved mod -> do - Just (_,m) <- gets (lookupModInSCs (SourceFileKey NormalHs mod) . (^. refSessMCs)) + Just (_,m) <- gets (lookupSourceFileInSCs mod . (^. refSessMCs)) case ( fmap semanticsModule (m ^? typedRecModule) <|> fmap semanticsModule (m ^? renamedRecModule) , fmap isBootModule (m ^? typedRecModule) <|> fmap isBootModule (m ^? renamedRecModule)) of (Just modName, Just isBoot) -> do @@ -191,8 +195,10 @@ let file = fromJust $ ml_hs_file $ ms_location ms modify $ (refSessMCs .- removeModule mod) liftIO $ removeFile file + return (SourceFileKey file mod) _ -> do liftIO $ hPutStrLn output ("Module " ++ mod ++ " could not be removed.") - return (SourceFileKey NormalHs mod) + return (SourceFileKey "" mod) + performChanges output True resMods = do forM_ resMods (liftIO . \case ContentChanged (n,m) -> do
− examples/Project/multi-packages-same-module/package1/A.hs
@@ -1,3 +0,0 @@-module A where - -x = ()
− examples/Project/multi-packages-same-module/package1/package1.cabal
@@ -1,18 +0,0 @@-name: package1 -version: 1.2.3.4 -synopsis: A package just for testing Haskell-tools support. Don't install it. -description: - -homepage: https://github.com/nboldi/haskell-tools -license: BSD3 -license-file: LICENSE -author: Boldizsar Nemeth -maintainer: nboldi@elte.hu -category: Language -build-type: Simple -cabal-version: >=1.10 - -library - exposed-modules: A - build-depends: base - default-language: Haskell2010
− examples/Project/multi-packages-same-module/package2/A.hs
@@ -1,1 +0,0 @@-module A where
− examples/Project/multi-packages-same-module/package2/package2.cabal
@@ -1,18 +0,0 @@-name: package2 -version: 1.2.3.4 -synopsis: A package just for testing Haskell-tools support. Don't install it. -description: - -homepage: https://github.com/nboldi/haskell-tools -license: BSD3 -license-file: LICENSE -author: Boldizsar Nemeth -maintainer: nboldi@elte.hu -category: Language -build-type: Simple -cabal-version: >=1.10 - -library - exposed-modules: A - build-depends: base - default-language: Haskell2010
+ examples/Project/with-main-renamed/A.hs view
@@ -0,0 +1,3 @@+module Main where + +main = putStrLn "Hello World"
+ examples/Project/with-main-renamed/some-test-package.cabal view
@@ -0,0 +1,18 @@+name: some-test-package +version: 1.2.3.4 +synopsis: A package just for testing Haskell-tools support. Don't install it. +description: + +homepage: https://github.com/nboldi/haskell-tools +license: BSD3 +license-file: LICENSE +author: Boldizsar Nemeth +maintainer: nboldi@elte.hu +category: Language +build-type: Simple +cabal-version: >=1.10 + +executable foo + main-is: A.hs + build-depends: base + default-language: Haskell2010
+ examples/Project/with-main/Main.hs view
@@ -0,0 +1,3 @@+module Main where + +main = putStrLn "Hello World"
+ examples/Project/with-main/some-test-package.cabal view
@@ -0,0 +1,18 @@+name: some-test-package +version: 1.2.3.4 +synopsis: A package just for testing Haskell-tools support. Don't install it. +description: + +homepage: https://github.com/nboldi/haskell-tools +license: BSD3 +license-file: LICENSE +author: Boldizsar Nemeth +maintainer: nboldi@elte.hu +category: Language +build-type: Simple +cabal-version: >=1.10 + +executable foo + main-is: Main.hs + build-depends: base + default-language: Haskell2010
+ examples/Project/with-multi-main/A.hs view
@@ -0,0 +1,5 @@+module Main where + +import B + +main = putStrLn (b ++ " World")
+ examples/Project/with-multi-main/B.hs view
@@ -0,0 +1,3 @@+module B where + +b = "Hello"
+ examples/Project/with-multi-main/Main.hs view
@@ -0,0 +1,3 @@+module Main where + +main = putStrLn "Hello World"
+ examples/Project/with-multi-main/some-test-package.cabal view
@@ -0,0 +1,24 @@+name: some-test-package +version: 1.2.3.4 +synopsis: A package just for testing Haskell-tools support. Don't install it. +description: + +homepage: https://github.com/nboldi/haskell-tools +license: BSD3 +license-file: LICENSE +author: Boldizsar Nemeth +maintainer: nboldi@elte.hu +category: Language +build-type: Simple +cabal-version: >=1.10 + +executable foo + main-is: A.hs + build-depends: base + default-language: Haskell2010 + other-modules: B + +executable bar + main-is: Main.hs + build-depends: base + default-language: Haskell2010
+ examples/Project/with-other-executable/A.hs view
@@ -0,0 +1,3 @@+module A where + +main = putStrLn "Hello World"
+ examples/Project/with-other-executable/some-test-package.cabal view
@@ -0,0 +1,19 @@+name: some-test-package +version: 1.2.3.4 +synopsis: A package just for testing Haskell-tools support. Don't install it. +description: + +homepage: https://github.com/nboldi/haskell-tools +license: BSD3 +license-file: LICENSE +author: Boldizsar Nemeth +maintainer: nboldi@elte.hu +category: Language +build-type: Simple +cabal-version: >=1.10 + +executable foo + main-is: A.hs + build-depends: base + default-language: Haskell2010 + ghc-options: -main-is A.main
+ examples/Project/working-dir/data.txt view
+ examples/Project/working-dir/some-test-package.cabal view
@@ -0,0 +1,19 @@+name: some-test-package +version: 1.2.3.4 +synopsis: A package just for testing Haskell-tools support. Don't install it. +description: + +homepage: https://github.com/nboldi/haskell-tools +license: BSD3 +license-file: LICENSE +author: Boldizsar Nemeth +maintainer: nboldi@elte.hu +category: Language +build-type: Simple +cabal-version: >=1.10 + +library + exposed-modules: A + hs-source-dirs: src + build-depends: base, directory, filepath + default-language: Haskell2010
+ examples/Project/working-dir/src/A.hs view
@@ -0,0 +1,7 @@+{-# LANGUAGE TemplateHaskell #-} +module A where + +import Language.Haskell.TH +import System.FilePath + +$(location >>= \loc -> runIO (readFile (takeDirectory (takeDirectory (loc_filename loc)) </> "data.txt")) >> return [])
haskell-tools-cli.cabal view
@@ -1,5 +1,5 @@ name: haskell-tools-cli -version: 0.7.0.0 +version: 0.8.0.0 synopsis: Command-line frontend for Haskell-tools Refact description: Command-line frontend for Haskell-tools Refact. Not meant as a final product, only for demonstration purposes. homepage: https://github.com/haskell-tools/haskell-tools @@ -26,16 +26,23 @@ , examples/Project/multi-packages-flags/package1/*.cabal , examples/Project/multi-packages-flags/package2/*.hs , examples/Project/multi-packages-flags/package2/*.cabal - , examples/Project/multi-packages-same-module/package1/*.hs - , examples/Project/multi-packages-same-module/package1/*.cabal - , examples/Project/multi-packages-same-module/package2/*.hs - , examples/Project/multi-packages-same-module/package2/*.cabal , examples/Project/no-cabal/*.hs , examples/Project/reloading/*.hs , examples/Project/selection/*.hs , examples/Project/source-dir/*.cabal , examples/Project/source-dir/src/*.hs , examples/Project/source-dir-outside/*.cabal + , examples/Project/working-dir/src/*.hs + , examples/Project/working-dir/*.cabal + , examples/Project/working-dir/*.txt + , examples/Project/with-main/*.hs + , examples/Project/with-main/*.cabal + , examples/Project/with-main-renamed/*.hs + , examples/Project/with-main-renamed/*.cabal + , examples/Project/with-multi-main/*.hs + , examples/Project/with-multi-main/*.cabal + , examples/Project/with-other-executable/*.hs + , examples/Project/with-other-executable/*.cabal , examples/Project/src/*.hs library @@ -49,17 +56,18 @@ , ghc-paths >= 0.1 && < 0.2 , references >= 0.3 && < 0.4 , strict >= 0.3 && < 0.4 - , haskell-tools-ast >= 0.7 && < 0.8 - , haskell-tools-prettyprint >= 0.7 && < 0.8 - , haskell-tools-refactor >= 0.7 && < 0.8 + , haskell-tools-ast >= 0.8 && < 0.9 + , haskell-tools-prettyprint >= 0.8 && < 0.9 + , haskell-tools-refactor >= 0.8 && < 0.9 exposed-modules: Language.Haskell.Tools.Refactor.CLI + , Paths_haskell_tools_cli default-language: Haskell2010 executable ht-refact ghc-options: -rtsopts build-depends: base >= 4.9 && < 4.10 - , haskell-tools-cli >= 0.7 && < 0.8 + , haskell-tools-cli >= 0.8 && < 0.9 hs-source-dirs: exe main-is: Main.hs default-language: Haskell2010 @@ -84,7 +92,7 @@ , tasty-hunit >= 0.9 && < 0.10 , directory >= 1.2 && < 1.4 , filepath >= 1.4 && < 2.0 - , haskell-tools-cli >= 0.7 && < 0.8 + , haskell-tools-cli >= 0.8 && < 0.9 , knob >= 0.1 && < 0.2 , bytestring >= 0.10 && < 0.11 default-language: Haskell2010 @@ -93,8 +101,8 @@ type: exitcode-stdio-1.0 ghc-options: -with-rtsopts=-M2g build-depends: base >= 4.9 && < 4.10 - , haskell-tools-cli >= 0.7 && < 0.8 - , criterion >= 1.1 && < 1.2 + , haskell-tools-cli >= 0.8 && < 0.9 + , criterion >= 1.1 && < 1.3 , time >= 1.6 && < 1.7 , aeson >= 1.0 && < 1.3 , directory >= 1.2 && < 1.4
test-stackage/Main.hs view
@@ -41,21 +41,23 @@ resultFile = "results.csv" noRetest = "-no-retest" `elem` args + noLoad = "-no-load" `elem` args testAndEvaluate p = do - (res, problem) <- testPackage p + (res, problem) <- testPackage noLoad p appendFile resultFile (p ++ ";" ++ show res ++ " ; " ++ problem ++ "\n") -testPackage :: String -> IO (Result, String) -testPackage pack = do - res <- runCommands - [ Left ("cabal get " ++ pack, GetFailure) - , Right refreshDir - , Left ("stack build --test --no-run-tests --bench --no-run-benchmarks > logs\\" ++ pack ++ "-build-log.txt 2>&1", BuildFailure) - -- correct rts option handling (on windows) requires stack 1.4 - , Left ("stack exec ht-refact --stack-yaml=..\\stack.yaml --rts-options -M4G -- -one-shot -refactoring=ProjectOrganizeImports tested-package tested-package\\.stack-work\\dist\\" ++ snapshotId ++ "\\build\\autogen -package base > logs\\" ++ pack ++ "-refact-log.txt 2>&1", RefactError) - , Left ("stack build > logs\\" ++ pack ++ "-reload-log.txt 2>&1", WrongCodeError) - ] +testPackage :: Bool -> String -> IO (Result, String) +testPackage noLoad pack = do + res <- runCommands $ load + ++ [ Left ("stack build --test --no-run-tests --bench --no-run-benchmarks > logs\\" ++ pack ++ "-build-log.txt 2>&1", BuildFailure) + -- correct rts option handling (on windows) requires stack 1.4 + , let autogenPath = "tested-package\\.stack-work\\dist\\" ++ snapshotId ++ "\\build\\autogen" + logPath = "logs\\" ++ pack ++ "-refact-log.txt 2>&1" + dbPaths = ["C:\\Users\\nboldi\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-8.0.2\\lib\\package.conf.d", "C:\\sr\\snapshots\\c095693b\\pkgdb"] + in Left ("stack exec ht-refact --stack-yaml=..\\stack.yaml --rts-options -M4G -- -one-shot -refactoring=ProjectOrganizeImports tested-package " ++ autogenPath ++ " -clear-package-db" ++ concatMap (" -package-db " ++) dbPaths ++ " -package base > " ++ logPath, RefactError) + , Left ("stack build > logs\\" ++ pack ++ "-reload-log.txt 2>&1", WrongCodeError) + ] problem <- case res of RefactError -> map (\case '\n' -> ' '; c -> c) <$> readFile ("logs\\" ++ pack ++ "-refact-log.txt") WrongCodeError -> map (\case '\n' -> ' '; c -> c) <$> readFile ("logs\\" ++ pack ++ "-reload-log.txt") @@ -63,7 +65,7 @@ return (res, problem) where testedDir = "tested-package" snapshotId = "ca59d0ab" - refreshDir = refreshDir' 3 + refreshDir = refreshDir' 5 refreshDir' n = do createDirectoryIfMissing False testedDir removeDirectoryRecursive testedDir renameDirectory pack testedDir @@ -71,6 +73,7 @@ then throwIO (e :: IOException) else do threadDelay 500000 refreshDir' (n-1) + load = if noLoad then [] else [ Left ("cabal get " ++ pack, GetFailure), Right refreshDir ] runCommands :: [Either (String, Result) (IO ())] -> IO Result runCommands [] = return OK
test/Main.hs view
@@ -23,20 +23,21 @@ allTests = map makeCliTest cliTests makeCliTest :: ([FilePath], [String], String, String) -> TestTree -makeCliTest (dirs, args, input, output) = let dir = joinPath $ longestCommonPrefix $ map splitDirectories dirs - testdirs = map (((dir ++ "_test") </>) . makeRelative dir) dirs - in testCase dir $ do - exists <- doesDirectoryExist (dir ++ "_test") - when exists $ removeDirectoryRecursive (dir ++ "_test") - copyDir dir (dir ++ "_test") - inKnob <- newKnob (pack input) - inHandle <- newFileHandle inKnob "<input>" ReadMode - outKnob <- newKnob (pack []) - outHandle <- newFileHandle outKnob "<output>" WriteMode - res <- refactorSession inHandle outHandle (args ++ testdirs) - actualOut <- Data.Knob.getContents outKnob - assertEqual "" (filter (/= '\r') output) (filter (/= '\r') $ unpack actualOut) - `finally` removeDirectoryRecursive (dir ++ "_test") +makeCliTest (dirs, args, input, output) + = let dir = joinPath $ longestCommonPrefix $ map splitDirectories dirs + testdirs = map (\d -> if d == dir then dir ++ "_test" else (dir ++ "_test" </> makeRelative dir d)) dirs + in testCase dir $ do + exists <- doesDirectoryExist (dir ++ "_test") + when exists $ removeDirectoryRecursive (dir ++ "_test") + copyDir dir (dir ++ "_test") + inKnob <- newKnob (pack input) + inHandle <- newFileHandle inKnob "<input>" ReadMode + outKnob <- newKnob (pack []) + outHandle <- newFileHandle outKnob "<output>" WriteMode + res <- refactorSession inHandle outHandle (args ++ testdirs) + actualOut <- Data.Knob.getContents outKnob + assertEqual "" (filter (/= '\r') output) (filter (/= '\r') $ unpack actualOut) + `finally` removeDirectoryRecursive (dir ++ "_test") cliTests :: [([FilePath], [String], String, String)] cliTests @@ -46,6 +47,9 @@ , ( [testRoot </> "Project" </> "source-dir"] , ["-dry-run", "-one-shot", "-module-name=A", "-refactoring=\"GenerateSignature 3:1-3:1\""] , "", oneShotPrefix ["A"] ++ "### Module changed: A\n### new content:\nmodule A where\n\nx :: ()\nx = ()\n") + , ( [testRoot </> "Project" </> "working-dir"] + , ["-dry-run", "-one-shot", "-module-name=A", "-refactoring=\"OrganizeImports\""] + , "", oneShotPrefix ["A"] ++ "### Module changed: A\n### new content:\n{-# LANGUAGE TemplateHaskell #-}\nmodule A where\n\nimport Language.Haskell.TH\nimport System.FilePath\n\n$(location >>= \\loc -> runIO (readFile (takeDirectory (takeDirectory (loc_filename loc)) </> \"data.txt\")) >> return [])\n\n") , ( [testRoot </> "Project" </> "source-dir-outside"] , ["-dry-run", "-one-shot", "-module-name=A", "-refactoring=\"GenerateSignature 3:1-3:1\""] , "", oneShotPrefix ["A"] ++ "### Module changed: A\n### new content:\nmodule A where\n\nx :: ()\nx = ()\n") @@ -74,13 +78,19 @@ , ["-dry-run", "-one-shot", "-module-name=A", "-refactoring=\"RenameDefinition 3:1-3:2 xx\""], "" , oneShotPrefix ["B", "A"] ++ "### Module changed: A\n### new content:\nmodule A where\n\nxx = \\case () -> ()\n" ) - , ( map ((testRoot </> "Project" </> "multi-packages-same-module") </>) ["package1", "package2"] - , ["-dry-run", "-one-shot", "-module-name=A", "-refactoring=\"RenameDefinition 3:1-3:2 xx\""], "" - , "Compiling modules. This may take some time. Please wait.\nLoaded module: A\n" - ++ "The following modules are ignored: A. Multiple modules with the same qualified name are not supported.\n" - ++ "All modules loaded.\n" - ++ "### Module changed: A\n### new content:\nmodule A where\n\nxx = ()\n" - ) + , ( [testRoot </> "Project" </> "with-main"] + , ["-dry-run", "-one-shot", "-module-name=Main", "-refactoring=\"GenerateSignature 3:1\""] + , "", oneShotPrefix ["Main"] ++ "### Module changed: Main\n### new content:\nmodule Main where\n\nmain :: IO ()\nmain = putStrLn \"Hello World\"\n") + , ( [testRoot </> "Project" </> "with-main-renamed"] + , ["-dry-run", "-one-shot", "-module-name=Main", "-refactoring=\"GenerateSignature 3:1\""] + , "", oneShotPrefix ["Main"] ++ "### Module changed: Main\n### new content:\nmodule Main where\n\nmain :: IO ()\nmain = putStrLn \"Hello World\"\n") + , ( [testRoot </> "Project" </> "with-multi-main"], ["-dry-run", "-one-shot", "-module-name=B", "-refactoring=\"RenameDefinition 3:1 bb\""], "" + , oneShotPrefix ["Main", "B", "Main"] + ++ "### Module changed: B\n### new content:\nmodule B where\n\nbb = \"Hello\"\n" + ++ "### Module changed: Main\n### new content:\nmodule Main where\n\nimport B\n\nmain = putStrLn (bb ++ \" World\")\n") + , ( [testRoot </> "Project" </> "with-other-executable"] + , ["-dry-run", "-one-shot", "-module-name=A", "-refactoring=\"GenerateSignature 3:1\""] + , "", oneShotPrefix ["A"] ++ "### Module changed: A\n### new content:\nmodule A where\n\nmain :: IO ()\nmain = putStrLn \"Hello World\"\n") ] benchTests :: IO [TestTree]