bindata 1.4.3 → 1.4.4
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/BSDL +1 -1
- data/ChangeLog +8 -0
- data/NEWS +7 -0
- data/lib/bindata.rb +3 -3
- data/lib/bindata/base.rb +7 -0
- data/lib/bindata/base_primitive.rb +2 -2
- data/lib/bindata/choice.rb +4 -0
- data/lib/bindata/io.rb +1 -1
- data/lib/bindata/lazy.rb +2 -2
- data/lib/bindata/sanitize.rb +9 -0
- data/lib/bindata/string.rb +33 -16
- data/manual.haml +55 -53
- data/manual.md +346 -253
- data/spec/alignment_spec.rb +7 -7
- data/spec/array_spec.rb +67 -66
- data/spec/base_primitive_spec.rb +47 -49
- data/spec/base_spec.rb +70 -73
- data/spec/bits_spec.rb +14 -14
- data/spec/choice_spec.rb +44 -41
- data/spec/count_bytes_remaining_spec.rb +8 -11
- data/spec/deprecated_spec.rb +29 -29
- data/spec/float_spec.rb +12 -12
- data/spec/int_spec.rb +24 -24
- data/spec/io_spec.rb +56 -56
- data/spec/lazy_spec.rb +41 -39
- data/spec/primitive_spec.rb +31 -33
- data/spec/record_spec.rb +55 -57
- data/spec/registry_spec.rb +25 -25
- data/spec/rest_spec.rb +5 -5
- data/spec/skip_spec.rb +3 -3
- data/spec/spec_common.rb +2 -2
- data/spec/string_spec.rb +38 -38
- data/spec/stringz_spec.rb +18 -18
- data/spec/struct_spec.rb +48 -48
- data/spec/system_spec.rb +38 -37
- data/spec/wrapper_spec.rb +21 -23
- data/tasks/pkg.rake +3 -3
- data/tasks/rdoc.rake +1 -1
- data/tasks/rspec.rake +7 -7
- metadata +51 -53
data/spec/wrapper_spec.rb
CHANGED
@@ -4,17 +4,15 @@ require File.expand_path(File.join(File.dirname(__FILE__), "spec_common"))
|
|
4
4
|
require 'bindata'
|
5
5
|
|
6
6
|
describe BinData::Wrapper do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
r.lookup("Wrapper")
|
12
|
-
}.should raise_error(BinData::UnRegisteredTypeError)
|
7
|
+
it "is not registered" do
|
8
|
+
expect {
|
9
|
+
BinData::RegisteredClasses.lookup("Wrapper")
|
10
|
+
}.to raise_error(BinData::UnRegisteredTypeError)
|
13
11
|
end
|
14
12
|
end
|
15
13
|
|
16
14
|
describe BinData::Wrapper, "with errors" do
|
17
|
-
it "
|
15
|
+
it "does not wrap more than one type" do
|
18
16
|
lambda {
|
19
17
|
class WrappedMultipleTypes < BinData::Wrapper
|
20
18
|
uint8
|
@@ -25,7 +23,7 @@ describe BinData::Wrapper, "with errors" do
|
|
25
23
|
}
|
26
24
|
end
|
27
25
|
|
28
|
-
it "
|
26
|
+
it "fails if wrapped type has a name" do
|
29
27
|
lambda {
|
30
28
|
class WrappedWithName < BinData::Wrapper
|
31
29
|
uint8 :a
|
@@ -35,7 +33,7 @@ describe BinData::Wrapper, "with errors" do
|
|
35
33
|
}
|
36
34
|
end
|
37
35
|
|
38
|
-
it "
|
36
|
+
it "fails if no types to wrap" do
|
39
37
|
class WrappedNoTypes < BinData::Wrapper
|
40
38
|
end
|
41
39
|
|
@@ -54,23 +52,23 @@ describe BinData::Wrapper, "around a Primitive" do
|
|
54
52
|
uint8 :initial_value => :a
|
55
53
|
end
|
56
54
|
|
57
|
-
it "
|
55
|
+
it "accesses custom parameter" do
|
58
56
|
subject = WrappedPrimitive.new
|
59
57
|
subject.assign(3)
|
60
58
|
subject.should == 3
|
61
59
|
end
|
62
60
|
|
63
|
-
it "
|
61
|
+
it "overrides custom default parameter" do
|
64
62
|
subject = WrappedPrimitive.new(:a => 5)
|
65
63
|
subject.should == 5
|
66
64
|
end
|
67
65
|
|
68
|
-
it "
|
66
|
+
it "overrides parameter" do
|
69
67
|
subject = WrappedPrimitive.new(:initial_value => 7)
|
70
68
|
subject.should == 7
|
71
69
|
end
|
72
70
|
|
73
|
-
it "
|
71
|
+
it "clears" do
|
74
72
|
subject = WrappedPrimitive.new
|
75
73
|
subject.assign(3)
|
76
74
|
subject.should_not be_clear
|
@@ -79,7 +77,7 @@ describe BinData::Wrapper, "around a Primitive" do
|
|
79
77
|
subject.should be_clear
|
80
78
|
end
|
81
79
|
|
82
|
-
it "
|
80
|
+
it "reads" do
|
83
81
|
subject = WrappedPrimitive.new
|
84
82
|
subject.assign(3)
|
85
83
|
str = subject.to_binary_s
|
@@ -87,7 +85,7 @@ describe BinData::Wrapper, "around a Primitive" do
|
|
87
85
|
WrappedPrimitive.read(str).should == 3
|
88
86
|
end
|
89
87
|
|
90
|
-
it "
|
88
|
+
it "respond_to and forward messages to the wrapped object" do
|
91
89
|
subject = WrappedPrimitive.new
|
92
90
|
subject.assign(5)
|
93
91
|
|
@@ -105,12 +103,12 @@ describe BinData::Wrapper, "around an Array" do
|
|
105
103
|
end
|
106
104
|
end
|
107
105
|
|
108
|
-
it "
|
106
|
+
it "forwards parameters" do
|
109
107
|
subject = WrappedIntArray.new(:initial_length => 7)
|
110
108
|
subject.length.should == 7
|
111
109
|
end
|
112
110
|
|
113
|
-
it "
|
111
|
+
it "overrides default parameters" do
|
114
112
|
subject = WrappedIntArray.new(:initial_length => 3, :initial_element_value => 5)
|
115
113
|
subject.to_binary_s.should == "\x00\x05\x00\x05\x00\x05"
|
116
114
|
end
|
@@ -122,7 +120,7 @@ describe BinData::Wrapper, "around a Choice" do
|
|
122
120
|
choice :choices => { 'a' => :uint8, 'b' => :uint16 }
|
123
121
|
end
|
124
122
|
|
125
|
-
it "
|
123
|
+
it "forwards parameters" do
|
126
124
|
subject = WrappedChoice.new(:selection => 'b')
|
127
125
|
subject.num_bytes.should == 2
|
128
126
|
end
|
@@ -138,7 +136,7 @@ describe BinData::Wrapper, "inside a Record" do
|
|
138
136
|
wrapped_uint32le :b, :onlyif => true, :value => 2
|
139
137
|
end
|
140
138
|
|
141
|
-
it "
|
139
|
+
it "handles onlyif" do
|
142
140
|
subject = RecordWithWrapped.new
|
143
141
|
subject.should == {'b' => 2}
|
144
142
|
end
|
@@ -155,17 +153,17 @@ describe BinData::Wrapper, "around a Record" do
|
|
155
153
|
record_to_be_wrapped
|
156
154
|
end
|
157
155
|
|
158
|
-
it "
|
156
|
+
it "forwards parameters" do
|
159
157
|
subject = WrappedRecord.new(:arg => 5)
|
160
158
|
subject.a.should == 5
|
161
159
|
end
|
162
160
|
|
163
|
-
it "
|
161
|
+
it "assigns value" do
|
164
162
|
subject = WrappedRecord.new(:b => 5)
|
165
163
|
subject.b.should == 5
|
166
164
|
end
|
167
165
|
|
168
|
-
it "
|
166
|
+
it "assigns value and forward parameters" do
|
169
167
|
subject = WrappedRecord.new({:b => 5}, :arg => 7)
|
170
168
|
subject.a.should == 7
|
171
169
|
subject.b.should == 5
|
@@ -180,7 +178,7 @@ describe BinData::Wrapper, "derived classes" do
|
|
180
178
|
class ChildDerivedWrapper < ParentDerivedWrapper
|
181
179
|
end
|
182
180
|
|
183
|
-
it "
|
181
|
+
it "wraps" do
|
184
182
|
a = ChildDerivedWrapper.new
|
185
183
|
a.num_bytes.should == 4
|
186
184
|
end
|
data/tasks/pkg.rake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
begin
|
2
2
|
require 'rubygems'
|
3
|
-
require '
|
3
|
+
require 'rubygems/package_task'
|
4
4
|
|
5
5
|
SPEC = Gem::Specification.new do |s|
|
6
6
|
s.name = 'bindata'
|
@@ -16,7 +16,7 @@ begin
|
|
16
16
|
s.extra_rdoc_files = ['NEWS']
|
17
17
|
s.rdoc_options << '--main' << 'NEWS'
|
18
18
|
s.files = PKG_FILES
|
19
|
-
s.add_development_dependency('rspec', [">=
|
19
|
+
s.add_development_dependency('rspec', [">= 2.10.0"])
|
20
20
|
s.add_development_dependency('haml')
|
21
21
|
s.add_development_dependency('maruku')
|
22
22
|
s.add_development_dependency('syntax')
|
@@ -30,7 +30,7 @@ begin
|
|
30
30
|
END
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
Gem::PackageTask.new(SPEC) do |pkg|
|
34
34
|
pkg.need_tar_gz = true
|
35
35
|
end
|
36
36
|
|
data/tasks/rdoc.rake
CHANGED
data/tasks/rspec.rake
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
begin
|
2
|
-
require '
|
3
|
-
require '
|
2
|
+
require 'rspec'
|
3
|
+
require 'rspec/core/rake_task'
|
4
4
|
|
5
|
-
|
6
|
-
t.
|
5
|
+
RSpec::Core::RakeTask.new("spec") do |t|
|
6
|
+
# t.ruby_opts = "-w"
|
7
7
|
t.rcov = false
|
8
|
-
t.
|
8
|
+
t.pattern = 'spec/**/*_spec.rb' #.exclude("spec/deprecated_spec.rb", "spec/wrapper_spec.rb")
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
t.
|
11
|
+
RSpec::Core::RakeTask.new("rcov") do |t|
|
12
|
+
t.ruby_opts = "-w"
|
13
13
|
t.rcov = true
|
14
14
|
end
|
15
15
|
rescue LoadError
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 1.4.
|
9
|
+
- 4
|
10
|
+
version: 1.4.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dion Mendel
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-06-21 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rspec
|
@@ -26,12 +25,12 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
28
|
+
hash: 39
|
30
29
|
segments:
|
31
|
-
-
|
32
|
-
-
|
30
|
+
- 2
|
31
|
+
- 10
|
33
32
|
- 0
|
34
|
-
version:
|
33
|
+
version: 2.10.0
|
35
34
|
type: :development
|
36
35
|
version_requirements: *id001
|
37
36
|
- !ruby/object:Gem::Dependency
|
@@ -92,77 +91,76 @@ extensions: []
|
|
92
91
|
extra_rdoc_files:
|
93
92
|
- NEWS
|
94
93
|
files:
|
95
|
-
- COPYING
|
96
94
|
- ChangeLog
|
95
|
+
- NEWS
|
96
|
+
- COPYING
|
97
97
|
- BSDL
|
98
|
+
- README
|
98
99
|
- Rakefile
|
99
100
|
- INSTALL
|
100
|
-
- README
|
101
|
-
- NEWS
|
102
|
-
- examples/gzip.rb
|
103
101
|
- examples/ip_address.rb
|
104
|
-
- examples/nbt.rb
|
105
|
-
- examples/NBT.txt
|
106
102
|
- examples/list.rb
|
103
|
+
- examples/gzip.rb
|
104
|
+
- examples/NBT.txt
|
105
|
+
- examples/nbt.rb
|
106
|
+
- spec/bits_spec.rb
|
107
|
+
- spec/stringz_spec.rb
|
107
108
|
- spec/count_bytes_remaining_spec.rb
|
108
|
-
- spec/base_spec.rb
|
109
|
-
- spec/string_spec.rb
|
110
|
-
- spec/record_spec.rb
|
111
|
-
- spec/example.rb
|
112
109
|
- spec/primitive_spec.rb
|
113
|
-
- spec/stringz_spec.rb
|
114
|
-
- spec/float_spec.rb
|
115
110
|
- spec/io_spec.rb
|
116
|
-
- spec/
|
117
|
-
- spec/
|
111
|
+
- spec/spec_common.rb
|
112
|
+
- spec/example.rb
|
118
113
|
- spec/lazy_spec.rb
|
119
|
-
- spec/wrapper_spec.rb
|
120
|
-
- spec/struct_spec.rb
|
121
114
|
- spec/rest_spec.rb
|
115
|
+
- spec/struct_spec.rb
|
116
|
+
- spec/record_spec.rb
|
117
|
+
- spec/deprecated_spec.rb
|
122
118
|
- spec/alignment_spec.rb
|
119
|
+
- spec/system_spec.rb
|
123
120
|
- spec/base_primitive_spec.rb
|
124
|
-
- spec/
|
121
|
+
- spec/array_spec.rb
|
125
122
|
- spec/int_spec.rb
|
126
|
-
- spec/bits_spec.rb
|
127
|
-
- spec/skip_spec.rb
|
128
123
|
- spec/choice_spec.rb
|
129
|
-
- spec/
|
130
|
-
- spec/
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
- lib/bindata/params.rb
|
136
|
-
- lib/bindata/array.rb
|
137
|
-
- lib/bindata/trace.rb
|
138
|
-
- lib/bindata/struct.rb
|
139
|
-
- lib/bindata/lazy.rb
|
124
|
+
- spec/string_spec.rb
|
125
|
+
- spec/base_spec.rb
|
126
|
+
- spec/registry_spec.rb
|
127
|
+
- spec/wrapper_spec.rb
|
128
|
+
- spec/skip_spec.rb
|
129
|
+
- spec/float_spec.rb
|
140
130
|
- lib/bindata/count_bytes_remaining.rb
|
141
|
-
- lib/bindata/
|
142
|
-
- lib/bindata/
|
131
|
+
- lib/bindata/lazy.rb
|
132
|
+
- lib/bindata/rest.rb
|
133
|
+
- lib/bindata/int.rb
|
134
|
+
- lib/bindata/array.rb
|
135
|
+
- lib/bindata/sanitize.rb
|
136
|
+
- lib/bindata/params.rb
|
143
137
|
- lib/bindata/string.rb
|
138
|
+
- lib/bindata/skip.rb
|
144
139
|
- lib/bindata/alignment.rb
|
145
|
-
- lib/bindata/int.rb
|
146
140
|
- lib/bindata/io.rb
|
141
|
+
- lib/bindata/registry.rb
|
142
|
+
- lib/bindata/deprecated.rb
|
143
|
+
- lib/bindata/primitive.rb
|
147
144
|
- lib/bindata/base_primitive.rb
|
148
|
-
- lib/bindata/
|
145
|
+
- lib/bindata/struct.rb
|
149
146
|
- lib/bindata/bits.rb
|
150
|
-
- lib/bindata/
|
151
|
-
- lib/bindata/primitive.rb
|
152
|
-
- lib/bindata/sanitize.rb
|
147
|
+
- lib/bindata/wrapper.rb
|
153
148
|
- lib/bindata/offset.rb
|
154
|
-
- lib/bindata/
|
155
|
-
- lib/bindata/
|
156
|
-
- lib/bindata/registry.rb
|
149
|
+
- lib/bindata/record.rb
|
150
|
+
- lib/bindata/dsl.rb
|
157
151
|
- lib/bindata/float.rb
|
152
|
+
- lib/bindata/choice.rb
|
153
|
+
- lib/bindata/base.rb
|
154
|
+
- lib/bindata/trace.rb
|
155
|
+
- lib/bindata/stringz.rb
|
156
|
+
- lib/bindata.rb
|
158
157
|
- tasks/rspec.rake
|
159
|
-
- tasks/pkg.rake
|
160
158
|
- tasks/manual.rake
|
161
159
|
- tasks/rdoc.rake
|
160
|
+
- tasks/pkg.rake
|
162
161
|
- setup.rb
|
163
162
|
- manual.haml
|
164
163
|
- manual.md
|
165
|
-
has_rdoc: true
|
166
164
|
homepage: http://bindata.rubyforge.org
|
167
165
|
licenses: []
|
168
166
|
|
@@ -193,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
191
|
requirements: []
|
194
192
|
|
195
193
|
rubyforge_project: bindata
|
196
|
-
rubygems_version: 1.
|
194
|
+
rubygems_version: 1.8.24
|
197
195
|
signing_key:
|
198
196
|
specification_version: 3
|
199
197
|
summary: A declarative way to read and write binary file formats
|