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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a4db841bf592779a772cd1965118786c6004bb5460a51d5f4154207970f2016
4
- data.tar.gz: dfebc39f1f2a3089d491050da6a58997401ac194f1cc3ef5602ff82a6a6554bb
3
+ metadata.gz: 2c4dad8d006c1df84f2f6e241e0309a6efdd41622e9d4469b72c5f4ab23c681f
4
+ data.tar.gz: 649973630d5544a6aa50185f20006d77ff75349d67448fe7b32b66417de87359
5
5
  SHA512:
6
- metadata.gz: 9c0ef8d9c2bbbc39eee0c63c591097431b8cd428f5f3cfa03fedc15158f22fc05b6efab56bbad5990f967f45400af07a9c205da1c5953873dff9dcdc6ac24237
7
- data.tar.gz: 03bcde0becfa611a100cb43c5d7982bfd3d156a264e817b9c01b1f4522fff7379a4279f25fa9f92d64535d411c597894adb7ba4004cc923c721721899cc9b99a
6
+ metadata.gz: 769971878d5575cb15cdab697ef7226f8e43c4a932e0f52fad91eaf32cbfeda2d8d027e10fb5be2498a6af2389b9bfe60aea0d1a11496303f0f5c55fdc582b0a
7
+ data.tar.gz: d623fe3a282df4a2fd68cc9235225ec56338ea0e02ffd6c659e797fd4369d651cd9087fc1457197546a2e05c149b9608f4686ebf58a850215be40588c76d69dd
@@ -1,5 +1,9 @@
1
1
  = BinData Changelog
2
2
 
3
+ == Version 2.4.6 (2020-02-27)
4
+
5
+ * More encoding fixes. Thanks to Aaron Patterson.
6
+
3
7
  == Version 2.4.5 (2020-02-21)
4
8
 
5
9
  * Small typo fixes to examples.
@@ -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,
@@ -1,3 +1,3 @@
1
1
  module BinData
2
- VERSION = "2.4.5"
2
+ VERSION = "2.4.6"
3
3
  end
@@ -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
-
@@ -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.5
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-21 00:00:00.000000000 Z
11
+ date: 2020-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake