Sha256: fb1699da5b69554c2a300095bd8ffc7aab400aa9c19e08c0fcd72facd7d8078a

Contents?: true

Size: 798 Bytes

Versions: 136

Compression:

Stored size: 798 Bytes

Contents

require 'test/unit'
require 'testunit-test-util'

class TestAttributeMatcher < Test::Unit::TestCase
  include TestUnitTestUtil

  def setup
    @test = {}
    @matcher = Test::Unit::AttributeMatcher.new(@test)
  end

  def test_nonexistent
    assert_false(@matcher.match?("nonexistent"))
  end

  def test_existent
    @test[:existent] = true
    assert_true(@matcher.match?("existent"))
  end

  def test_and
    @test[:slow] = true
    @test[:important] = true
    assert_true(@matcher.match?("important and slow"))
  end

  def test_complex
    @test[:tags] = [:slow, :web]
    @test[:bug] = "2929"
    assert_true(@matcher.match?("tags.include?(:web) or bug == '29'"))
  end

  def test_exception
    assert_raise(NoMethodError) do
      @matcher.match?("nonexistent > 100")
    end
  end
end

Version data entries

136 entries across 106 versions & 10 rubygems

Version Path
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/test-unit-3.2.3/test/test-attribute-matcher.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/test-unit-3.2.3/test/test-attribute-matcher.rb
tdiary-5.0.4 vendor/bundle/gems/test-unit-3.2.3/test/test-attribute-matcher.rb
ruby-compiler-0.1.1 vendor/ruby/gems/test-unit-3.2.3/test/test-attribute-matcher.rb
test-unit-3.2.3 test/test-attribute-matcher.rb
test-unit-3.2.2 test/test-attribute-matcher.rb
tdiary-5.0.2 vendor/bundle/gems/test-unit-3.2.1/test/test-attribute-matcher.rb
test-unit-3.2.1 test/test-attribute-matcher.rb
tdiary-5.0.1 vendor/bundle/gems/test-unit-3.2.0/test/test-attribute-matcher.rb
windows-pr-1.2.5 vendor/bundle/ruby/2.2.0/gems/win32-api-1.6.0-universal-mingw32/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute-matcher.rb
test-unit-3.2.0 test/test-attribute-matcher.rb
win32-api-1.6.0-universal-mingw32 vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute-matcher.rb
test-unit-3.1.9 test/test-attribute-matcher.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/test-unit-3.1.8/test/test-attribute-matcher.rb
test-unit-3.1.8 test/test-attribute-matcher.rb
test-unit-3.1.7 test/test-attribute-matcher.rb
test-unit-3.1.6 test/test-attribute-matcher.rb
test-unit-3.1.5 test/test-attribute-matcher.rb
test-unit-3.1.4 test/test-attribute-matcher.rb
test-unit-3.1.3 test/test-attribute-matcher.rb