Class UnifiedMatchers::TestStreamMatchers
In: lib/unified_matchers/stream_matcher.rb
Parent: ::Test::Unit::TestCase

Methods

Included Modules

UnifiedMatchers::Assertions

Public Instance methods

[Source]

# File lib/unified_matchers/stream_matcher.rb, line 32
      def setup
        self.matcher = StreamMatcher.new
      end

[Source]

# File lib/unified_matchers/stream_matcher.rb, line 36
      def teardown
      end

[Source]

# File lib/unified_matchers/stream_matcher.rb, line 39
      def test_stream_matcher
        assert_failure 'a', 'b'
        assert_success(/^a$/, 'a')
        assert_success 'a', 'a'
        assert_failure(/^a$/, /^a$/)
        assert_success "(?-mix:^a$)", /^a$/
        assert_success(/\d/, 4)
        assert_success '42', 42
        assert_success 42, '42'
        s = StringIO.new
        s << 'foo'
        assert_success 'foo', s
        assert_failure 'bar', s
        assert_success 'foo', s
        assert_success Integer, 42
        assert_failure String, 42
        assert_failure 42, Integer
        TempPath.new do |t|
          t.overwrite 'foo'
          assert_success 'foo', t
          assert_success(/fo+/, t.open)
          assert_success t, t
          f = t.open
          assert_success f, f
        end
      end

[Source]

# File lib/unified_matchers/stream_matcher.rb, line 66
      def test_with_a_new_class
        c = Class.new
        assert_success(/^#<#<Class:.*>.*>$/, c.new)
        StreamMatcher.rule(:test_with_a_new_class, c, :before => :to_s) { object_id }
        assert_failure(/^#<#<Class:.*>.*>$/, c.new)
        assert_success(/^\d+$/, c.new)
      end

[Validate]