diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2017-08-23 22:03:18 -0700 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2017-09-13 14:27:52 -0700 |
commit | c1dd8e85a1314a7bcb2059b842c6830d854fbefa (patch) | |
tree | 24b15fc50665a56b9c658c31623a9fddcdde38bf /ruby/tests | |
parent | 8741da3e45876f8c55ca062a08726f542f646423 (diff) | |
download | protobuf-c1dd8e85a1314a7bcb2059b842c6830d854fbefa.tar.gz protobuf-c1dd8e85a1314a7bcb2059b842c6830d854fbefa.tar.bz2 protobuf-c1dd8e85a1314a7bcb2059b842c6830d854fbefa.zip |
Move parse frame array to the Map object
This makes the frame stack per-parser, and per-thread. Fixes #3250
Diffstat (limited to 'ruby/tests')
-rw-r--r-- | ruby/tests/basic.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb index 020effb0..94071ca0 100644 --- a/ruby/tests/basic.rb +++ b/ruby/tests/basic.rb @@ -96,8 +96,18 @@ module BasicTest optional :d, :enum, 4, "TestEnum" end end + + add_message "repro.Outer" do + map :items, :int32, :message, 1, "repro.Inner" + end + + add_message "repro.Inner" do + end end + + Outer = pool.lookup("repro.Outer").msgclass + Inner = pool.lookup("repro.Inner").msgclass Foo = pool.lookup("Foo").msgclass Bar = pool.lookup("Bar").msgclass Baz = pool.lookup("Baz").msgclass @@ -675,6 +685,21 @@ module BasicTest m.map_string_int32['aaa'] = 3 end + def test_concurrent_decoding + o = Outer.new + o.items[0] = Inner.new + raw = Outer.encode(o) + + thds = 2.times.map do + Thread.new do + 100000.times do + assert_equal o, Outer.decode(raw) + end + end + end + thds.map(&:join) + end + def test_map_encode_decode m = MapMessage.new( :map_string_int32 => {"a" => 1, "b" => 2}, |