Skip to content

Commit

Permalink
whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
jetaggart committed Mar 11, 2015
1 parent 8a5d6ad commit fb14b91
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/Te/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ import qualified Te.History as History


runTest :: TestRunner -> Sh ()
runTest testRunner@(TestRunner exe args) = do
runTest testRunner@(NewTestRunner exe args) = do
History.record testRunner
runTest' exe args

runTest (OldTestRunner exe args) = runTest' exe args

-- echo $ (pack . show) testRunner

runTest' :: Executable -> [Argument] -> Sh ()
runTest' exe args = do
let executable = unpack exe
arguments = fmap unpack args
liftIO $ rawSystem executable arguments
Expand All @@ -43,11 +50,7 @@ getTestRunner args = do


lastTestRunner :: Sh (Maybe TestRunner)
lastTestRunner = do
item <- History.lastItem
return $ case (headMay item) of
Just executable -> Just $ TestRunner executable (tailSafe item)
Nothing -> Nothing
lastTestRunner = History.last


frameworks :: [TestFramework]
Expand All @@ -58,11 +61,11 @@ getRunner :: [Argument] -> TestFramework -> Sh (Maybe TestRunner)
getRunner args RSpec = do
rspecFile <- hasFile ".rspec"
return $ case rspecFile of
True -> Just $ TestRunner "rspec" args
True -> Just $ NewTestRunner "rspec" args
False -> Nothing

getRunner args Minitest = do
testFile <- hasFile "test"
return $ case testFile of
True -> Just $ TestRunner "rake" ("test" : args)
True -> Just $ NewTestRunner "rake" ("test" : args)
False -> Nothing

0 comments on commit fb14b91

Please sign in to comment.