Sha256: 48a89fe684903b8bf3d743103900350b3992b91c799547dca32ef62441d145d5

Contents?: true

Size: 880 Bytes

Versions: 15

Compression:

Stored size: 880 Bytes

Contents

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

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

      it 'unindents :static' do
        source   = [:static, "  Hello World"]
        expected = [:static, "Hello World"]
        optimize(source).should eq(expected)
      end

      it 'unindents :static when multiple lines' do
        source   = [:static, "  Hello\n  World"]
        expected = [:static, "Hello\nWorld"]
        optimize(source).should eq(expected)
      end

      it 'recurses on :strconcat' do
        source   = [:strconcat, [:static, "  Hello"], [:static, "  World"]]
        expected = [:strconcat, [:static, "Hello"], [:static, "World"]]
        optimize(source).should eq(expected)
      end

    end # describe Autospacing::Unindent
  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_unindent.rb
wlang-3.0.0 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.3.1 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.3.0 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.2.4 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.2.3 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.2.2 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.2.1 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.2.0 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.1.2 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.1.1 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.1.0 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.0.1 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.0.0 spec/unit/compiler/autospacing/test_unindent.rb
wlang-2.0.0.beta spec/unit/compiler/autospacing/test_unindent.rb