bindata 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bindata might be problematic. Click here for more details.
- data/ChangeLog +7 -0
- data/lib/bindata.rb +1 -1
- data/lib/bindata/array.rb +1 -1
- data/lib/bindata/struct.rb +6 -0
- data/manual.md +1 -1
- data/spec/array_spec.rb +6 -0
- data/spec/system_spec.rb +15 -0
- metadata +4 -4
data/ChangeLog
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
= BinData Changelog
|
2
2
|
|
3
|
+
== Version 1.4.3 (2011-10-01)
|
4
|
+
|
5
|
+
* Exceptions no longer ignored inside lambdas when reading until eof
|
6
|
+
in an array (thanks John Labovitz).
|
7
|
+
* Fixed interaction bug between choices and records (reported by
|
8
|
+
Refrigerator Johnny).
|
9
|
+
|
3
10
|
== Version 1.4.2 (2011-08-06)
|
4
11
|
|
5
12
|
* =~ now works for strings.
|
data/lib/bindata.rb
CHANGED
data/lib/bindata/array.rb
CHANGED
data/lib/bindata/struct.rb
CHANGED
data/manual.md
CHANGED
data/spec/array_spec.rb
CHANGED
@@ -278,6 +278,12 @@ describe BinData::Array, "with :read_until" do
|
|
278
278
|
subject.read "\x00\x01\x00\x02\x03"
|
279
279
|
subject.should == [1, 2]
|
280
280
|
end
|
281
|
+
|
282
|
+
it "should report exceptions" do
|
283
|
+
array_type = [:string, {:read_length => lambda { unknown_variable }}]
|
284
|
+
subject = BinData::Array.new(:type => array_type, :read_until => :eof)
|
285
|
+
lambda { subject.read "\x00\x01\x00\x02\x03" }.should raise_error
|
286
|
+
end
|
281
287
|
end
|
282
288
|
end
|
283
289
|
|
data/spec/system_spec.rb
CHANGED
@@ -342,6 +342,21 @@ describe BinData::Record, "with custom sized integers" do
|
|
342
342
|
end
|
343
343
|
end
|
344
344
|
|
345
|
+
describe BinData::Record, "with choice field" do
|
346
|
+
class ChoiceFieldRecord < BinData::Record
|
347
|
+
int8 :a
|
348
|
+
choice :b, :selection => :a do
|
349
|
+
struct 1, :fields => [[:int8, :v]]
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
it "should assign" do
|
354
|
+
subject = BinData::Array.new(:type => :choice_field_record)
|
355
|
+
obj = ChoiceFieldRecord.new(:a => 1, :b => {:v => 3})
|
356
|
+
subject.assign([obj])
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
345
360
|
describe BinData::Primitive, "representing a string" do
|
346
361
|
class PascalStringPrimitive < BinData::Primitive
|
347
362
|
uint8 :len, :value => lambda { data.length }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 1.4.
|
9
|
+
- 3
|
10
|
+
version: 1.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dion Mendel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-01 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|