diff options
author | Adam Greene <adam.greene@gmail.com> | 2015-05-01 08:54:18 -0700 |
---|---|---|
committer | Adam Greene <adam.greene@gmail.com> | 2015-05-01 11:48:04 -0700 |
commit | c70b6058eaae4fa5b1af577c548e6809a53dfd98 (patch) | |
tree | 89693f839c21940349003769811d22ecbb9e78b3 /ruby/tests/basic.rb | |
parent | c881159557398c915b6b279b45c618732741416b (diff) | |
download | protobuf-c70b6058eaae4fa5b1af577c548e6809a53dfd98.tar.gz protobuf-c70b6058eaae4fa5b1af577c548e6809a53dfd98.tar.bz2 protobuf-c70b6058eaae4fa5b1af577c548e6809a53dfd98.zip |
add size alias for length
starting to make `RepeatedField` quack like an array
additional changes:
* make sure gemspec gets all ruby code files
* add homepage in gem spec removes one of the warnings, and the gem spec authors are pushing
everyone to include a homepage in the gem
* remove excess whitespace in test suite to bring formatting inline with the rest of the file
Diffstat (limited to 'ruby/tests/basic.rb')
-rw-r--r-- | ruby/tests/basic.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb index 1c3fb62c..307374e3 100644 --- a/ruby/tests/basic.rb +++ b/ruby/tests/basic.rb @@ -377,6 +377,18 @@ module BasicTest end end + def test_rptfield_array_ducktyping + l = Google::Protobuf::RepeatedField.new(:int32) + length_methods = %w(count length size) + length_methods.each do |lm| + assert l.send(lm) == 0 + end + l.push 4 + length_methods.each do |lm| + assert l.send(lm) == 1 + end + end + def test_map_basic # allowed key types: # :int32, :int64, :uint32, :uint64, :bool, :string, :bytes. @@ -827,7 +839,6 @@ module BasicTest assert m['a.b'] == 4 end - def test_int_ranges m = TestMessage.new @@ -933,7 +944,6 @@ module BasicTest assert_raise RangeError do m.optional_uint64 = 1.5 end - end def test_stress_test |