Sha256: a6cd870b1b0db0623daf78377f0419a18c892a79a060f6e4fea61970d4175a9f
Contents?: true
Size: 680 Bytes
Versions: 4
Compression:
Stored size: 680 Bytes
Contents
covers 'facets/proc/curry' testcase Proc do unit :curry do f = Proc.new{ |a,b,c| a + b + c } c = f.curry c[1][2][3].assert == 6 end unit :curry => "with arguments" do f = Proc.new{ |a,b| a**b } c = f.curry(0) c[2][3].assert == 8 f = Proc.new{ |a,b| a**b } c = f.curry(1) c[2][3].assert == 9 end unit :curry => "with in class scope" do # first test the lambda org = lambda{ |y, x| x + " " + y } foo = org.curry['yeah'] foo['boo'].assert == 'boo yeah' # now test it as a method definition baz = Class.new baz.__send__(:define_method, 'foo', foo) baz.new.foo('boo').assert == 'boo yeah' end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
facets-2.9.1 | test/core/proc/test_curry.rb |
facets-2.9.0 | test/core/proc/test_curry.rb |
facets-2.9.0.pre.2 | test/core/proc/test_curry.rb |
facets-2.9.0.pre.1 | test/core/proc/test_curry.rb |