Sha256: c66d55142c5d27b972c6b78593eb016d90cde6cc91a076f0e9daefa519b64b9a

Contents?: true

Size: 454 Bytes

Versions: 70

Compression:

Stored size: 454 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

RSpec.describe Code::Parser::IfModifier do
  [
    ["1 if true", "1"],
    ["1 if false", "nothing"],
    ["1 unless true", "nothing"],
    ["1 unless false", "1"],
    ["a = 0 a += 1 while a < 10 a", "10"],
    ["a = 0 a += 1 until a > 10 a", "11"]
  ].each do |input, expected|
    it "#{input} == #{expected}" do
      expect(Code.evaluate(input)).to eq(Code.evaluate(expected))
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
code-ruby-0.7.1 spec/code/parser/if_modifier_spec.rb
code-ruby-0.7.0 spec/code/parser/if_modifier_spec.rb
code-ruby-0.6.7 spec/code/parser/if_modifier_spec.rb
code-ruby-0.6.6 spec/code/parser/if_modifier_spec.rb
code-ruby-0.6.5 spec/code/parser/if_modifier_spec.rb
code-ruby-0.6.4 spec/code/parser/if_modifier_spec.rb
code-ruby-0.6.3 spec/code/parser/if_modifier_spec.rb
code-ruby-0.6.2 spec/code/parser/if_modifier_spec.rb
code-ruby-0.6.1 spec/code/parser/if_modifier_spec.rb
code-ruby-0.6.0 spec/code/parser/if_modifier_spec.rb