@@ -2,8 +2,6 @@ module Test.Data.Array.NonEmpty (testNonEmptyArray) where
22
33import Prelude
44
5- import Effect (Effect )
6- import Effect.Console (log )
75import Data.Array.NonEmpty as NEA
86import Data.Const (Const (..))
97import Data.Foldable (for_ , sum , traverse_ )
@@ -13,6 +11,8 @@ import Data.Monoid.Additive (Additive(..))
1311import Data.Semigroup.Foldable (foldMap1 )
1412import Data.Semigroup.Traversable (traverse1 )
1513import Data.Tuple (Tuple (..))
14+ import Effect (Effect )
15+ import Effect.Console (log , logShow )
1616import Partial.Unsafe (unsafePartial )
1717import Test.Assert (assert )
1818
@@ -234,9 +234,12 @@ testNonEmptyArray = do
234234 log " nub should remove duplicate elements from the list, keeping the first occurence"
235235 assert $ NEA .nub (fromArray [1 , 2 , 2 , 3 , 4 , 1 ]) == fromArray [1 , 2 , 3 , 4 ]
236236
237- log " nubBy should remove duplicate items from the list using a supplied predicate"
237+ log " nubEq should remove duplicate elements from the list, keeping the first occurence"
238+ assert $ NEA .nubEq (fromArray [1 , 2 , 2 , 3 , 4 , 1 ]) == fromArray [1 , 2 , 3 , 4 ]
239+
240+ log " nubByEq should remove duplicate items from the list using a supplied predicate"
238241 let nubPred = \x y -> if odd x then false else x == y
239- assert $ NEA .nubBy nubPred (fromArray [1 , 2 , 2 , 3 , 3 , 4 , 4 , 1 ]) == fromArray [1 , 2 , 3 , 3 , 4 , 1 ]
242+ assert $ NEA .nubByEq nubPred (fromArray [1 , 2 , 2 , 3 , 3 , 4 , 4 , 1 ]) == fromArray [1 , 2 , 3 , 3 , 4 , 1 ]
240243
241244 log " union should produce the union of two arrays"
242245 assert $ NEA .union (fromArray [1 , 2 , 3 ]) (fromArray [2 , 3 , 4 ]) == fromArray [1 , 2 , 3 , 4 ]
0 commit comments