aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-08-13 11:55:24 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-08-13 11:55:24 +0900
commitc1e0672e58a621b16ef34c22b2f603dc5d193968 (patch)
tree09434ff78fd5322eeb8b50f0b269291da18aefd1 /test
parentc8551ca9b98110322d48fb536b3fdcc65bcd423b (diff)
downloadplum-c1e0672e58a621b16ef34c22b2f603dc5d193968.tar.gz
hpack: context: fix searching dynamic table
Diffstat (limited to 'test')
-rw-r--r--test/plum/hpack/test_context.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/plum/hpack/test_context.rb b/test/plum/hpack/test_context.rb
index cb92361..86654ec 100644
--- a/test/plum/hpack/test_context.rb
+++ b/test/plum/hpack/test_context.rb
@@ -34,11 +34,29 @@ class HPACKContextTest < Minitest::Test
}
end
+ def test_search_static
+ context = new_context
+ i1 = context.search(":method", "POST")
+ assert_equal(3, i1)
+ end
+
+ def test_search_dynamic
+ context = new_context
+ context.store("あああ", "abc")
+ context.store("あああ", "いい")
+ i1 = context.search("あああ", "abc")
+ assert_equal(63, i1)
+ i2 = context.search("あああ", "AAA")
+ assert_equal(nil, i2)
+ i3 = context.search("あああ", nil)
+ assert_equal(62, i3)
+ end
+
private
def new_context(limit = 1 << 31)
@c ||= Class.new {
include Plum::HPACK::Context
- public :initialize, :store, :fetch, :evict
+ public *Plum::HPACK::Context.private_instance_methods
}
@c.new(limit)
end