Ruby generator support for "begin" blocks

This commit is contained in:
Yorick Peterse committed 2015-08-19 20:14:21 +02:00
1 parent 92b43a7500
commit 04aa8f6546
4 files changed
+48

No files matched your search

+13
View File
@@ -37,6 +37,19 @@ describe Oga::Ruby::Generator do
end
end
describe '#on_begin' do
it 'returns a String' do
number = Oga::Ruby::Node.new(:lit, %w{10})
node = Oga::Ruby::Node.new(:begin, [number])
@generator.on_begin(node).should == <<-EOF
begin
10
end
EOF
end
end
describe '#on_eq' do
it 'returns a String' do
var = Oga::Ruby::Node.new(:lit, %w{number})
+10
View File
@@ -88,6 +88,16 @@ describe Oga::Ruby::Node do
end
end
describe '#wrap' do
it 'returns a begin Node' do
number = described_class.new(:lit, %w{10})
wrapped = number.wrap
wrapped.type.should == :begin
wrapped.to_a.should == [number]
end
end
describe '#if_true' do
it 'returns an if statement Node' do
condition = described_class.new(:lit, %w{number})