bencode_ext 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
data/bencode_ext.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bencode_ext}
8
- s.version = "0.2.5"
8
+ s.version = "0.2.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["naquad"]
12
- s.date = %q{2011-01-19}
12
+ s.date = %q{2011-01-22}
13
13
  s.description = %q{BEncodeExt is implementation of Bencode reader/writer (BitTorent encoding) in C.}
14
14
  s.email = %q{naquad@gmail.com}
15
15
  s.extensions = ["ext/bencode_ext/extconf.rb"]
@@ -157,6 +157,8 @@ static VALUE decode(VALUE self, VALUE encoded){
157
157
 
158
158
  if(len)
159
159
  rb_raise(DecodeError, "String has garbage on the end (starts at %d).", rlen - len);
160
+ else if(!NIL_P(current_container))
161
+ rb_raise(DecodeError, "Unpexpected end of %s.", BUILTIN_TYPE(current_container) == T_HASH ? "dictionary" : "list");
160
162
 
161
163
  return ret;
162
164
  }
@@ -27,6 +27,7 @@ class TestBencodeExt < Test::Unit::TestCase
27
27
  assert_raises(BEncode::DecodeError) {'33:unpexpected_end'.bdecode }
28
28
  assert_raises(BEncode::DecodeError) { 'i1x'.bdecode }
29
29
  assert_raises(BEncode::DecodeError) { '2:asd'.bdecode }
30
+ assert_raises(BEncode::DecodeError) { 'd'.bdecode }
30
31
  assert_raises(ArgumentError) { BEncode.max_depth = 1.1 }
31
32
  assert_raises(ArgumentError) { BEncode.max_depth = -5 }
32
33
  assert_raises(BEncode::DecodeError) do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 5
9
- version: 0.2.5
8
+ - 6
9
+ version: 0.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - naquad
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-19 00:00:00 +02:00
17
+ date: 2011-01-22 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency