bindata 2.4.5 → 2.4.6
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.
- checksums.yaml +4 -4
- data/ChangeLog.rdoc +4 -0
- data/lib/bindata/io.rb +3 -1
- data/lib/bindata/version.rb +1 -1
- data/test/buffer_test.rb +0 -20
- data/test/system_test.rb +34 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c4dad8d006c1df84f2f6e241e0309a6efdd41622e9d4469b72c5f4ab23c681f
|
4
|
+
data.tar.gz: 649973630d5544a6aa50185f20006d77ff75349d67448fe7b32b66417de87359
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 769971878d5575cb15cdab697ef7226f8e43c4a932e0f52fad91eaf32cbfeda2d8d027e10fb5be2498a6af2389b9bfe60aea0d1a11496303f0f5c55fdc582b0a
|
7
|
+
data.tar.gz: d623fe3a282df4a2fd68cc9235225ec56338ea0e02ffd6c659e797fd4369d651cd9087fc1457197546a2e05c149b9608f4686ebf58a850215be40588c76d69dd
|
data/ChangeLog.rdoc
CHANGED
data/lib/bindata/io.rb
CHANGED
@@ -213,7 +213,9 @@ module BinData
|
|
213
213
|
|
214
214
|
# Creates a StringIO around +str+.
|
215
215
|
def self.create_string_io(str = "")
|
216
|
-
StringIO.new(str.dup.force_encoding(Encoding::BINARY))
|
216
|
+
s = StringIO.new(str.dup.force_encoding(Encoding::BINARY))
|
217
|
+
s.binmode
|
218
|
+
s
|
217
219
|
end
|
218
220
|
|
219
221
|
# Create a new IO Read wrapper around +io+. +io+ must provide #read,
|
data/lib/bindata/version.rb
CHANGED
data/test/buffer_test.rb
CHANGED
@@ -52,25 +52,6 @@ describe BinData::Buffer, "subclassed with a single type" do
|
|
52
52
|
obj.to_binary_s.must_equal_binary "\000\003\000\000\000"
|
53
53
|
end
|
54
54
|
|
55
|
-
it "returns binary encoded data" do
|
56
|
-
obj = IntBuffer.new(3)
|
57
|
-
obj.to_binary_s.encoding.must_equal Encoding::ASCII_8BIT
|
58
|
-
end
|
59
|
-
|
60
|
-
it "returns binary encoded data despite Encoding.default_internal" do
|
61
|
-
w, $-w = $-w, false
|
62
|
-
before_enc = Encoding.default_internal
|
63
|
-
|
64
|
-
begin
|
65
|
-
Encoding.default_internal = Encoding::UTF_8
|
66
|
-
obj = IntBuffer.new(3)
|
67
|
-
obj.to_binary_s.encoding.must_equal Encoding::ASCII_8BIT
|
68
|
-
ensure
|
69
|
-
Encoding.default_internal = before_enc
|
70
|
-
$-w = w
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
55
|
it "has total num_bytes" do
|
75
56
|
obj = IntBuffer.new
|
76
57
|
assert obj.clear?
|
@@ -172,4 +153,3 @@ describe BinData::Buffer, "nested buffers" do
|
|
172
153
|
obj.to_binary_s.must_equal_binary "abcdeABCDE12345"
|
173
154
|
end
|
174
155
|
end
|
175
|
-
|
data/test/system_test.rb
CHANGED
@@ -360,3 +360,37 @@ describe BinData::Record, "with boolean parameters" do
|
|
360
360
|
obj.a.must_equal 2
|
361
361
|
end
|
362
362
|
end
|
363
|
+
|
364
|
+
describe BinData::Record, "encoding" do
|
365
|
+
class EncodingTestBufferRecord < BinData::Record
|
366
|
+
endian :big
|
367
|
+
default_parameter length: 5
|
368
|
+
|
369
|
+
uint16 :num
|
370
|
+
string :str, length: 10
|
371
|
+
end
|
372
|
+
|
373
|
+
it "returns binary encoded data" do
|
374
|
+
obj = EncodingTestBufferRecord.new(num: 3)
|
375
|
+
obj.to_binary_s.encoding.must_equal Encoding::ASCII_8BIT
|
376
|
+
end
|
377
|
+
|
378
|
+
it "returns binary encoded data with utf-8 string" do
|
379
|
+
obj = EncodingTestBufferRecord.new(num: 3, str: "日本語")
|
380
|
+
obj.to_binary_s.encoding.must_equal Encoding::ASCII_8BIT
|
381
|
+
end
|
382
|
+
|
383
|
+
it "returns binary encoded data despite Encoding.default_internal" do
|
384
|
+
w, $-w = $-w, false
|
385
|
+
before_enc = Encoding.default_internal
|
386
|
+
|
387
|
+
begin
|
388
|
+
Encoding.default_internal = Encoding::UTF_8
|
389
|
+
obj = EncodingTestBufferRecord.new(num: 3, str: "日本語")
|
390
|
+
obj.to_binary_s.encoding.must_equal Encoding::ASCII_8BIT
|
391
|
+
ensure
|
392
|
+
Encoding.default_internal = before_enc
|
393
|
+
$-w = w
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dion Mendel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|