aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby/tests
diff options
context:
space:
mode:
authorGravatar Aaron Patterson <aaron.patterson@gmail.com>2017-08-23 22:03:18 -0700
committerGravatar Aaron Patterson <aaron.patterson@gmail.com>2017-08-30 11:38:04 -0700
commitd6152dd51c833bae79208ee8c03bd6a1d21fe632 (patch)
tree8a35303a817236f4dcb74ef0fc32e871e5aad524 /ruby/tests
parent364060bb51d172811395420026688409bcc7c74e (diff)
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.rb25
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},