Sha256: 9e68e982a28dc93cbb19dc0b763ee475d3ec36b72d42cd7333b6495bf87c02df
Contents?: true
Size: 973 Bytes
Versions: 15
Compression:
Stored size: 973 Bytes
Contents
require 'spec_helper' module WLang class Compiler describe StrconcatFlattener do def optimize(source) StrconcatFlattener.new.call(source) end it 'cleans singleton' do source = [:strconcat, [:static, "Hello World!"]] expected = [:static, "Hello World!"] optimize(source).should eq(expected) end it 'does nothing on single :strconcat' do source = [:strconcat, [:static, "Hello "], [:static, "World"]] expected = [:strconcat, [:static, "Hello "], [:static, "World"]] optimize(source).should eq(expected) end it 'flattens :strconcat' do source = [:strconcat, [:strconcat, [:static, "Hello "], [:static, "World"]], [:static, "!"]] expected = [:strconcat, [:static, "Hello "], [:static, "World"], [:static, "!"]] optimize(source).should eq(expected) end end # describe StrconcatFlattener end # class Compiler end # module WLang
Version data entries
15 entries across 15 versions & 1 rubygems