Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1095

Show
Ignore:
Timestamp:
12/02/03 11:23:35 (5 years ago)
Author:
nahi
Message:

* do not allow deleting key from locked property.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/soap/property.rb

    r1092 r1095  
    127127 
    128128  def local_assign(key, value) 
    129     if @locked and propkey?(value) 
    130       raise TypeError.new("cannot add any key to locked property") 
     129    if @locked 
     130      if propkey?(value) 
     131        raise TypeError.new("cannot add any key to locked property") 
     132      elsif propkey?(@store[key]) 
     133        raise TypeError.new("cannot override any key in locked property") 
     134      end 
    131135    end 
    132136    @store[key] = value 
  • trunk/test/soap/test_property.rb

    r1092 r1095  
    153153    end 
    154154    assert_nil(@prop["a.a"]) 
    155     @prop["a.b"] = nil 
    156     assert_nil(@prop["a.b"]) 
    157155    @prop["a.a"] = 2 
     156    assert_equal(2, @prop["a.a"]) 
    158157    # 
    159158    @prop.unlock 
     
    201200    assert_equal(branch, @prop[:a][:b][:d]) 
    202201    @prop.lock 
     202    # split error 1 
    203203    assert_raises(TypeError) do 
    204204      @prop["a.b"] 
    205205    end 
     206    # split error 2 
    206207    assert_raises(TypeError) do 
    207208      @prop["a"] 
     
    209210    @prop["a.b.c"] = 2 
    210211    assert_equal(2, @prop["a.b.c"]) 
     212    # replace error 
    211213    assert_raises(TypeError) do 
    212214      @prop["a.b.c"] = ::SOAP::Property.new 
    213215    end 
     216    # override error 
     217    assert_raises(TypeError) do 
     218      @prop["a.b"] = 1 
     219    end 
    214220  end 
    215221end