@@ -7,6 +7,7 @@ import Control.Concurrent (threadDelay)
77import Control.Monad (replicateM)
88import Data.Foldable (forM_)
99import Data.List (sort)
10+import Data.Maybe (fromJust, isNothing)
1011import Test.Hspec
1112
1213import Streamly
@@ -675,9 +676,8 @@ streamOperations (stream, list, len) = do
675676 it "dropWhile < some" $ transform (A.dropWhile (< (len `div` 2)))
676677 (dropWhile (< (len `div` 2)))
677678
678− it "scan left" $ transform (A.scan (+) 0 id) (scanl (+) 0)
679−
680679 -- Transformations
680+ it "scan left" $ transform (A.scan (+) 0 id) (scanl (+) 0)
681681 it "reverse" $ transform A.reverse reverse
682682
683683 -- Elimination
@@ -699,15 +699,18 @@ streamOperations (stream, list, len) = do
699699 it "maximum empty" $ A.maximum stream `shouldReturn` Nothing
700700 it "minimum empty" $ A.minimum stream `shouldReturn` Nothing
701701 it "null empty" $ A.null stream `shouldReturn` True
702+ it "tail empty" $ A.tail stream >>=
703+ \t -> if isNothing t then return () else expectationFailure "failed"
702704 else do
703705 it "head nonEmpty" $ A.head stream `shouldReturn` Just (head list)
704706 it "last nonEmpty" $ A.last stream `shouldReturn` Just (last list)
705707 it "maximum nonEmpty" $ A.maximum stream `shouldReturn` Just (maximum list)
706708 it "minimum nonEmpty" $ A.minimum stream `shouldReturn` Just (minimum list)
707709 it "null nonEmpty" $ A.null stream `shouldReturn` False
710+ it "tail nonEmpty" $
711+ (A.tail stream >>= A.toList . fromJust) `shouldReturn` tail list
708712
709713 where
710−
711714 -- XXX run on empty stream as well
712715 transform streamOp listOp =
713716 (A.toList $ streamOp stream) `shouldReturn` listOp list