Sha256: 253a6941f839efeb7e6195bc3c90533adaf1fb61c7ba0eaa982edb88d6ba7a8e

Contents?: true

Size: 1.32 KB

Versions: 68

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

require 'helper'

class TestLexerStackState < Minitest::Test
  def setup
    @state = Parser::Lexer::StackState.new('state')
  end

  def test_push
    refute @state.active?

    assert_equal true, @state.push(true)
    assert @state.active?

    assert_equal false, @state.push(false)
    refute @state.active?
  end

  def test_clear
    @state.push true
    @state.clear

    refute @state.active?
  end

  def test_pop
    @state.push(true)

    assert_equal true, @state.pop
    refute @state.active?
  end

  def test_pop_empty
    assert_equal false, @state.pop
    refute @state.active?
  end

  def test_lexpop_10
    @state.push(true)
    @state.push(false)

    assert_equal true, @state.lexpop
    assert_equal true, @state.pop
  end

  def test_lexpop_01
    @state.push(false)
    @state.push(true)

    assert_equal true, @state.lexpop
    assert_equal true, @state.pop
  end

  def test_lexpop_00
    @state.push(false)
    @state.push(false)

    assert_equal false, @state.lexpop
    assert_equal false, @state.pop
  end

  def test_dup
    @state.push(true)
    new_state = @state.dup

    assert_equal true, @state.pop
    assert_equal true, new_state.pop
  end

  def test_to_s
    @state.push(true)
    @state.push(false)
    @state.push(false)

    assert_equal '[100 <= state]', @state.to_s
  end
end

Version data entries

68 entries across 54 versions & 10 rubygems

Version Path
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_lexer_stack_state.rb
parser-2.6.4.1 test/test_lexer_stack_state.rb
parser-2.6.4.0 test/test_lexer_stack_state.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/parser-2.6.3.0/test/test_lexer_stack_state.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/parser-2.6.3.0/test/test_lexer_stack_state.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/parser-2.6.3.0/test/test_lexer_stack_state.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/parser-2.6.3.0/test/test_lexer_stack_state.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/parser-2.6.3.0/test/test_lexer_stack_state.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/parser-2.6.3.0/test/test_lexer_stack_state.rb
parser-2.6.3.0 test/test_lexer_stack_state.rb
parser-2.6.2.1 test/test_lexer_stack_state.rb
parser-2.6.2.0 test/test_lexer_stack_state.rb
parser-2.6.0.0 test/test_lexer_stack_state.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/parser-2.5.3.0/test/test_lexer_stack_state.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/parser-2.5.3.0/test/test_lexer_stack_state.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/parser-2.5.3.0/test/test_lexer_stack_state.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/parser-2.5.3.0/test/test_lexer_stack_state.rb
parser-2.5.3.0 test/test_lexer_stack_state.rb
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_lexer_stack_state.rb
parser-2.5.1.2 test/test_lexer_stack_state.rb