Skip to content

Commit

Permalink
Update language/delegation_spec
Browse files Browse the repository at this point in the history
This code does not yet work, but it no longer causes compile errors. Run
the blocks, and use NATFIXME to catch the error.
  • Loading branch information
herwinw committed Dec 16, 2024
1 parent 1104312 commit bf54779
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions spec/language/delegation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,28 @@ def delegate(...)
end

describe "delegation with def(x, ...)" do
# NATFIXME: Support Prism::ForwardingParameterNode
xit "delegates rest and kwargs" do
#a = Class.new(DelegationSpecs::Target) do
#def delegate(x, ...)
#target(...)
#end
#end
it "delegates rest and kwargs" do
a = Class.new(DelegationSpecs::Target) do
def delegate(x, ...)
target(...)
end
end

#a.new.delegate(0, 1, b: 2).should == [[1], {b: 2}]
NATFIXME 'Partial delegation', exception: SpecFailedException do
a.new.delegate(0, 1, b: 2).should == [[1], {b: 2}]
end
end

# NATFIXME: Support Prism::ForwardingParameterNode
xit "delegates block" do
#a = Class.new(DelegationSpecs::Target) do
#def delegate_block(x, ...)
#target_block(...)
#end
#end
it "delegates block" do
a = Class.new(DelegationSpecs::Target) do
def delegate_block(x, ...)
target_block(...)
end
end

#a.new.delegate_block(0, 1, b: 2) { |x| x }.should == [{b: 2}, [1]]
NATFIXME 'Partial delegation', exception: SpecFailedException do
a.new.delegate_block(0, 1, b: 2) { |x| x }.should == [{b: 2}, [1]]
end
end
end

Expand Down

0 comments on commit bf54779

Please sign in to comment.