Sha256: b9209c8574965237743daa1a58e0748aae59f855bb3dfea3768f41d6d71581ae

Contents?: true

Size: 896 Bytes

Versions: 6

Compression:

Stored size: 896 Bytes

Contents

require 'facets/equitable'
require 'test/unit'

class TestModuleEquatable < Test::Unit::TestCase

  def test_equatable_with_arguments
    c = Class.new
    c.class_eval { 
      include Equitable(:a,:b)
      attr_accessor :a, :b
    }
    c1,c2 = c.new,c.new
    c1.a = 10; c1.b = 20
    c2.a = 10; c2.b = 20
    assert_equal( c1, c2 )
    c1.a = 10; c1.b = 10
    c2.a = 10; c2.b = 20
    assert_not_equal( c1, c2 )
    c1.a = 10; c1.b = 20
    c2.a = 20; c2.b = 20
    assert_not_equal( c1, c2 )
  end

=begin
  def test_equate_on_old
    c = Class.new
    c.class_eval { attr_accessor :a, :b ; equate_on :a,:b }
    c1,c2 = c.new,c.new
    c1.a = 10; c1.b = 20
    c2.a = 10; c2.b = 20
    assert_equal( c1, c2 )
    c1.a = 10; c1.b = 10
    c2.a = 10; c2.b = 20
    assert_not_equal( c1, c2 )
    c1.a = 10; c1.b = 20
    c2.a = 20; c2.b = 20
    assert_not_equal( c1, c2 )
  end
=end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facets-2.8.4 test/more/test_equitable.rb
facets-2.8.3 test/more/test_equitable.rb
facets-2.8.2 test/more/test_equitable.rb
facets-2.8.1 test/more/test_equitable.rb
facets-2.8.0 test/more/test_equitable.rb
facets-2.7.0 test/more/test_equitable.rb