Sha256: 50bde12eb06d1c6baca416752de01eb898ff140e5233f598709e2ab3fd5b1b53

Contents?: true

Size: 921 Bytes

Versions: 15

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'
module WLang
  class Compiler
    describe Autospacing::RightStrip do

      def optimize(source)
        Autospacing::RightStrip.new.call(source)
      end

      it 'does not touch single line statics' do
        source   = [:static, "Hello World"]
        expected = [:static, "Hello World"]
        optimize(source).should eq(expected)
      end

      it 'strips at right on :static' do
        source   = [:static, "Hello World  \n  "]
        expected = [:static, "Hello World"]
        optimize(source).should eq(expected)
      end

      it 'strips the right-most :static on :strconcat' do
        source   = [:strconcat, [:static, "Hello  \n"], [:static, "  World\n"]]
        expected = [:strconcat, [:static, "Hello  \n"], [:static, "  World"]]
        optimize(source).should eq(expected)
      end

    end # describe Autospacing::RightStrip
  end # class Compiler
end # module WLang

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wlang-3.0.1 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-3.0.0 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.3.1 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.3.0 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.2.4 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.2.3 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.2.2 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.2.1 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.2.0 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.1.2 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.1.1 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.1.0 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.0.1 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.0.0 spec/unit/compiler/autospacing/test_right_strip.rb
wlang-2.0.0.beta spec/unit/compiler/autospacing/test_right_strip.rb