Sha256: 9c89ae3bf7097e4fbd169def35ccb814595fcca824ef7246a8c0a90179ea4441

Contents?: true

Size: 717 Bytes

Versions: 13

Compression:

Stored size: 717 Bytes

Contents

require 'test/unit'
require 'facets/aop'

class TestAop < Test::Unit::TestCase

  class X
    def x; "x"; end
    def y; "y"; end
    def q; "<" + x + ">"; end
  end

  Xa = Aspect.new do
    join :x do |jp|
      jp == :x
    end

    def x(target); '{' + target.super + '}'; end
  end

  X.apply(Xa)

  def setup
    @x1 = X.new
  end

  def test_class
    assert_equal(X, @x1.class)
  end

  def test_public_methods
    meths = @x1.public_methods(false)
    assert(meths.include?("y"))
    assert(meths.include?("q"))
    assert(meths.include?("x"))
  end

  def test_x
    assert_equal("{x}", @x1.x)
  end

  def test_y
    assert_equal("y", @x1.y)
  end

  def test_q
    assert_equal("<{x}>", @x1.q)
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
facets-2.0.1 test/unit/test_aop.rb
facets-2.0.0 test/unit/test_aop.rb
facets-2.0.2 test/unit/test_aop.rb
facets-2.0.4 test/unit/test_aop.rb
facets-2.1.0 test/unit/test_aop.rb
facets-2.1.1 test/unit/test_aop.rb
facets-2.0.5 test/unit/test_aop.rb
facets-2.1.2 test/unit/test_aop.rb
facets-2.0.3 test/unit/test_aop.rb
facets-2.1.3 test/unit/test_aop.rb
facets-2.2.0 test/unit/test_aop.rb
facets-2.2.1 test/unit/test_aop.rb
facets-2.3.0 test/more/test_aop.rb