Skip to content

Commit

Permalink
Avoid importing Function
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Jun 30, 2022
1 parent 0a8cdbe commit 3b99fc4
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions test/Tests/src/Data/Function_Spec.enso
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
from Standard.Base import all
import Standard.Base.Data.Numbers
import Standard.Base.Function

import Standard.Test
from Standard.Base.Data.Ordering import Equal, Less, Greater

spec =
Test.group "Function.identity" <|
Test.group "identity" <|
Test.specify "identity on number" <|
(Function.identity 5) . should_equal 5
(identity 5) . should_equal 5

Test.specify "identity on text" <|
(Function.identity '5') . should_equal '5'
(identity '5') . should_equal '5'

Test.specify "identity on boolean" <|
(Function.identity False) . should_equal False
(identity False) . should_equal False

Test.group "Function.flip" <|
Test.group "flip" <|
Test.specify "flip on number" <|
(Function.flip (-) 2 5) . should_equal 3
(flip (-) 2 5) . should_equal 3

Test.specify "flip on text" <|
(Function.flip (+) "world" "hello") . should_equal "helloworld"
(flip (+) "world" "hello") . should_equal "helloworld"

Test.group "Function.const" <|
Test.group "const" <|
Test.specify "const on number" <|
two = Function.const 2
two = const 2
two 5 . should_equal 2

Test.group "Function.curry" <|
Test.group "curry" <|
Test.specify "curry on number list" <|
sum = x -> x.fold 0 (+)
sum [1, 2, 3, 4] . should_equal 10
plus = Function.curry sum
plus = curry sum
plus 6 3 . should_equal 9

Test.group "Function.uncurry" <|
Test.group "uncurry" <|
Test.specify "uncurry on number list" <|
plus = Function.uncurry (*)
plus = uncurry (*)
plus [6, 7] . should_equal 42


Expand Down

0 comments on commit 3b99fc4

Please sign in to comment.