virtfs 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +154 -0
- data/Rakefile +5 -0
- data/lib/virtfs-nativefs-thick.rb +1 -0
- data/lib/virtfs-nativefs-thin.rb +1 -0
- data/lib/virtfs.rb +38 -0
- data/lib/virtfs/activation.rb +97 -0
- data/lib/virtfs/block_io.rb +140 -0
- data/lib/virtfs/byte_range.rb +71 -0
- data/lib/virtfs/context.rb +300 -0
- data/lib/virtfs/context_manager.rb +175 -0
- data/lib/virtfs/context_switch_class_methods.rb +96 -0
- data/lib/virtfs/delegate_module.rb +40 -0
- data/lib/virtfs/dir_instance_delegate.rb +3 -0
- data/lib/virtfs/exception.rb +13 -0
- data/lib/virtfs/file_instance_delegate.rb +3 -0
- data/lib/virtfs/file_modes_and_options.rb +293 -0
- data/lib/virtfs/find_class_methods.rb +106 -0
- data/lib/virtfs/io_buffer.rb +133 -0
- data/lib/virtfs/io_instance_delegate.rb +3 -0
- data/lib/virtfs/kernel.rb +146 -0
- data/lib/virtfs/nativefs/thick.rb +30 -0
- data/lib/virtfs/nativefs/thick/dir_class_methods.rb +38 -0
- data/lib/virtfs/nativefs/thick/file_class_methods.rb +178 -0
- data/lib/virtfs/nativefs/thin.rb +32 -0
- data/lib/virtfs/nativefs/thin/dir.rb +30 -0
- data/lib/virtfs/nativefs/thin/dir_class_methods.rb +41 -0
- data/lib/virtfs/nativefs/thin/file.rb +112 -0
- data/lib/virtfs/nativefs/thin/file_class_methods.rb +181 -0
- data/lib/virtfs/protofs/protofs.rb +7 -0
- data/lib/virtfs/protofs/protofs_base.rb +12 -0
- data/lib/virtfs/protofs/protofs_dir.rb +13 -0
- data/lib/virtfs/protofs/protofs_dir_class.rb +31 -0
- data/lib/virtfs/protofs/protofs_file.rb +27 -0
- data/lib/virtfs/protofs/protofs_file_class.rb +136 -0
- data/lib/virtfs/stat.rb +100 -0
- data/lib/virtfs/thin_dir_delegator.rb +79 -0
- data/lib/virtfs/thin_file_delegator.rb +77 -0
- data/lib/virtfs/thin_io_delegator_methods.rb +301 -0
- data/lib/virtfs/thin_io_delegator_methods_bufferio.rb +337 -0
- data/lib/virtfs/v_dir.rb +238 -0
- data/lib/virtfs/v_file.rb +480 -0
- data/lib/virtfs/v_io.rb +243 -0
- data/lib/virtfs/v_pathname.rb +128 -0
- data/lib/virtfs/version.rb +3 -0
- data/spec/activate_spec.rb +202 -0
- data/spec/chroot_spec.rb +120 -0
- data/spec/context_manager_class_spec.rb +246 -0
- data/spec/context_manager_instance_spec.rb +255 -0
- data/spec/context_spec.rb +335 -0
- data/spec/data/UTF-16LE-data.txt +0 -0
- data/spec/data/UTF-8-data.txt +212 -0
- data/spec/dir_class_spec.rb +506 -0
- data/spec/dir_instance_spec.rb +208 -0
- data/spec/file_class_spec.rb +2106 -0
- data/spec/file_instance_spec.rb +154 -0
- data/spec/file_modes_and_options_spec.rb +1556 -0
- data/spec/find_spec.rb +142 -0
- data/spec/io_bufferio_size_shared_examples.rb +371 -0
- data/spec/io_bufferio_size_spec.rb +861 -0
- data/spec/io_bufferio_spec.rb +801 -0
- data/spec/io_class_spec.rb +145 -0
- data/spec/io_instance_spec.rb +516 -0
- data/spec/kernel_spec.rb +285 -0
- data/spec/mount_spec.rb +186 -0
- data/spec/nativefs_local_root_spec.rb +132 -0
- data/spec/path_spec.rb +39 -0
- data/spec/spec_helper.rb +126 -0
- data/tasks/rspec.rake +3 -0
- data/tasks/yard.rake +7 -0
- data/test/UTF-8-demo.txt +212 -0
- data/test/bench.rb +18 -0
- data/test/bio_internal_test.rb +45 -0
- data/test/delegate_io.rb +31 -0
- data/test/delegate_module.rb +62 -0
- data/test/encode_test.rb +42 -0
- data/test/enoent_test.rb +30 -0
- data/test/namespace_test.rb +42 -0
- data/test/read_block_valid_encoding.rb +44 -0
- data/test/read_test.rb +78 -0
- data/test/stream_readers.rb +46 -0
- data/test/utf-16-demo.txt +0 -0
- data/test/utf8_to_utf16.rb +77 -0
- data/test/wrapper_test.rb +34 -0
- data/virtfs.gemspec +29 -0
- metadata +230 -0
@@ -0,0 +1,861 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'io_bufferio_size_shared_examples'
|
3
|
+
|
4
|
+
describe VirtFS::VIO, "(#{$fs_interface} interface)" do
|
5
|
+
before(:all) do
|
6
|
+
@data_dir = VfsRealFile.join(__dir__, "data")
|
7
|
+
@utf_8_filename = VfsRealFile.join(@data_dir, "UTF-8-data.txt")
|
8
|
+
@utf_16_filename = VfsRealFile.join(@data_dir, "UTF-16LE-data.txt")
|
9
|
+
|
10
|
+
@start_marker = "START OF FILE:\n"
|
11
|
+
@end_marker = ":END OF FILE"
|
12
|
+
@data1 = "0123456789"
|
13
|
+
@data2 = "abcdefghijklmnopqrstuvwzyz\n"
|
14
|
+
|
15
|
+
@temp_file = Tempfile.new("VirtFS-IO")
|
16
|
+
@temp_file.write(@start_marker)
|
17
|
+
(0..9).each do
|
18
|
+
@temp_file.write(@data1)
|
19
|
+
@temp_file.write(@data2)
|
20
|
+
end
|
21
|
+
@temp_file.write(@end_marker)
|
22
|
+
@temp_file.close
|
23
|
+
|
24
|
+
@full_path = @temp_file.path
|
25
|
+
@file_size = VfsRealFile.size(@full_path)
|
26
|
+
|
27
|
+
@temp_write = Tempfile.new("VirtFS-IO")
|
28
|
+
@temp_write.close
|
29
|
+
@write_file_path = @temp_write.path
|
30
|
+
|
31
|
+
@default_encoding = Encoding.default_external
|
32
|
+
@binary_encoding = Encoding.find("ASCII-8BIT")
|
33
|
+
end
|
34
|
+
|
35
|
+
before(:each) do
|
36
|
+
reset_context
|
37
|
+
|
38
|
+
@root = File::SEPARATOR
|
39
|
+
@native_fs = nativefs_class.new
|
40
|
+
VirtFS.mount(@native_fs, @root)
|
41
|
+
|
42
|
+
@vfile_read_obj = VirtFS::VFile.new(@full_path, "r")
|
43
|
+
@vfile_write_obj = VirtFS::VFile.new(@write_file_path, "w")
|
44
|
+
end
|
45
|
+
|
46
|
+
after(:each) do
|
47
|
+
@vfile_read_obj.close unless @vfile_read_obj.closed?
|
48
|
+
@vfile_write_obj.close unless @vfile_write_obj.closed?
|
49
|
+
VirtFS.umount(@root)
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Run the set of tests for each buffer size.
|
54
|
+
#
|
55
|
+
buffer_test_sizes.each do |buf_sz|
|
56
|
+
describe "#bytes - Buffer size: #{buf_sz}" do # deprecated
|
57
|
+
before(:each) do
|
58
|
+
@vfile_read_obj.send(:min_read_buf_sz=, buf_sz)
|
59
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
60
|
+
end
|
61
|
+
|
62
|
+
after(:each) do
|
63
|
+
@rfile_obj.close
|
64
|
+
end
|
65
|
+
|
66
|
+
it_should_behave_like "common_bytes"
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "#chars - Buffer size: #{buf_sz}" do
|
70
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
71
|
+
before(:each) do
|
72
|
+
@test_file_size = @file_size
|
73
|
+
@expected_full_read_size = @file_size
|
74
|
+
@vfile_read_test_obj = @vfile_read_obj
|
75
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
76
|
+
@expected_returned_encoding = Encoding.default_external
|
77
|
+
|
78
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
79
|
+
end
|
80
|
+
|
81
|
+
after(:each) do
|
82
|
+
@rfile_obj.close
|
83
|
+
end
|
84
|
+
|
85
|
+
it_should_behave_like "common_chars"
|
86
|
+
end
|
87
|
+
|
88
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
89
|
+
before(:each) do
|
90
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
91
|
+
@expected_full_read_size = @test_file_size
|
92
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
93
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8")
|
94
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
95
|
+
|
96
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
97
|
+
end
|
98
|
+
|
99
|
+
after(:each) do
|
100
|
+
@vfile_read_test_obj.close
|
101
|
+
@rfile_obj.close
|
102
|
+
end
|
103
|
+
|
104
|
+
it_should_behave_like "common_chars"
|
105
|
+
end
|
106
|
+
|
107
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
108
|
+
before(:each) do
|
109
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
110
|
+
@expected_full_read_size = @test_file_size
|
111
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
112
|
+
@rfile_obj = VfsRealFile.new(@utf_16_filename, "rb:UTF-16LE")
|
113
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
114
|
+
|
115
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
116
|
+
end
|
117
|
+
|
118
|
+
after(:each) do
|
119
|
+
@vfile_read_test_obj.close
|
120
|
+
@rfile_obj.close
|
121
|
+
end
|
122
|
+
|
123
|
+
it_should_behave_like "common_chars"
|
124
|
+
end
|
125
|
+
|
126
|
+
context "Transcode UTF-8 to UTF-16LE (buffer size: #{buf_sz})" do
|
127
|
+
before(:each) do
|
128
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
129
|
+
@expected_full_read_size = VfsRealFile.size(@utf_16_filename)
|
130
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
131
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
132
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
133
|
+
|
134
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
135
|
+
end
|
136
|
+
|
137
|
+
after(:each) do
|
138
|
+
@vfile_read_test_obj.close
|
139
|
+
@rfile_obj.close
|
140
|
+
end
|
141
|
+
|
142
|
+
it_should_behave_like "common_chars"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe "#each - Buffer size: #{buf_sz}" do
|
147
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
148
|
+
before(:each) do
|
149
|
+
@test_file_size = @file_size
|
150
|
+
@expected_full_read_size = @file_size
|
151
|
+
@vfile_read_test_obj = @vfile_read_obj
|
152
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
153
|
+
@expected_returned_encoding = Encoding.default_external
|
154
|
+
|
155
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
156
|
+
end
|
157
|
+
|
158
|
+
after(:each) do
|
159
|
+
@rfile_obj.close
|
160
|
+
end
|
161
|
+
|
162
|
+
it_should_behave_like "common_each"
|
163
|
+
end
|
164
|
+
|
165
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
166
|
+
before(:each) do
|
167
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
168
|
+
@expected_full_read_size = @test_file_size
|
169
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
170
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8")
|
171
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
172
|
+
|
173
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
174
|
+
end
|
175
|
+
|
176
|
+
after(:each) do
|
177
|
+
@vfile_read_test_obj.close
|
178
|
+
@rfile_obj.close
|
179
|
+
end
|
180
|
+
|
181
|
+
it_should_behave_like "common_each"
|
182
|
+
end
|
183
|
+
|
184
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
185
|
+
before(:each) do
|
186
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
187
|
+
@expected_full_read_size = @test_file_size
|
188
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
189
|
+
@rfile_obj = VfsRealFile.new(@utf_16_filename, "rb:UTF-16LE")
|
190
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
191
|
+
|
192
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
193
|
+
end
|
194
|
+
|
195
|
+
after(:each) do
|
196
|
+
@vfile_read_test_obj.close
|
197
|
+
@rfile_obj.close
|
198
|
+
end
|
199
|
+
|
200
|
+
it_should_behave_like "common_each"
|
201
|
+
end
|
202
|
+
|
203
|
+
context "Transcode UTF-8 to UTF-16LE (buffer size: #{buf_sz})" do
|
204
|
+
before(:each) do
|
205
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
206
|
+
@expected_full_read_size = VfsRealFile.size(@utf_16_filename)
|
207
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
208
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
209
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
210
|
+
|
211
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
212
|
+
end
|
213
|
+
|
214
|
+
after(:each) do
|
215
|
+
@vfile_read_test_obj.close
|
216
|
+
@rfile_obj.close
|
217
|
+
end
|
218
|
+
|
219
|
+
it_should_behave_like "common_each"
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
describe "#each_byte - Buffer size: #{buf_sz}" do
|
224
|
+
context "Buffer size: #{buf_sz}" do
|
225
|
+
before(:each) do
|
226
|
+
@vfile_read_obj.send(:min_read_buf_sz=, buf_sz)
|
227
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
228
|
+
end
|
229
|
+
|
230
|
+
after(:each) do
|
231
|
+
@rfile_obj.close
|
232
|
+
end
|
233
|
+
|
234
|
+
it_should_behave_like "common_each_byte"
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
describe "#each_char - Buffer size: #{buf_sz}" do
|
239
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
240
|
+
before(:each) do
|
241
|
+
@test_file_size = @file_size
|
242
|
+
@expected_full_read_size = @file_size
|
243
|
+
@vfile_read_test_obj = @vfile_read_obj
|
244
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
245
|
+
@expected_returned_encoding = Encoding.default_external
|
246
|
+
|
247
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
248
|
+
end
|
249
|
+
|
250
|
+
after(:each) do
|
251
|
+
@rfile_obj.close
|
252
|
+
end
|
253
|
+
|
254
|
+
it_should_behave_like "common_each_char"
|
255
|
+
end
|
256
|
+
|
257
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
258
|
+
before(:each) do
|
259
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
260
|
+
@expected_full_read_size = @test_file_size
|
261
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
262
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8")
|
263
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
264
|
+
|
265
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
266
|
+
end
|
267
|
+
|
268
|
+
after(:each) do
|
269
|
+
@vfile_read_test_obj.close
|
270
|
+
@rfile_obj.close
|
271
|
+
end
|
272
|
+
|
273
|
+
it_should_behave_like "common_each_char"
|
274
|
+
end
|
275
|
+
|
276
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
277
|
+
before(:each) do
|
278
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
279
|
+
@expected_full_read_size = @test_file_size
|
280
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
281
|
+
@rfile_obj = VfsRealFile.new(@utf_16_filename, "rb:UTF-16LE")
|
282
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
283
|
+
|
284
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
285
|
+
end
|
286
|
+
|
287
|
+
after(:each) do
|
288
|
+
@vfile_read_test_obj.close
|
289
|
+
@rfile_obj.close
|
290
|
+
end
|
291
|
+
|
292
|
+
it_should_behave_like "common_each_char"
|
293
|
+
end
|
294
|
+
|
295
|
+
context "Transcode UTF-8 to UTF-16LE (buffer size: #{buf_sz})" do
|
296
|
+
before(:each) do
|
297
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
298
|
+
@expected_full_read_size = VfsRealFile.size(@utf_16_filename)
|
299
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
300
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
301
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
302
|
+
|
303
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
304
|
+
end
|
305
|
+
|
306
|
+
after(:each) do
|
307
|
+
@vfile_read_test_obj.close
|
308
|
+
@rfile_obj.close
|
309
|
+
end
|
310
|
+
|
311
|
+
it_should_behave_like "common_each_char"
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
describe "#each_codepoint - Buffer size: #{buf_sz}" do
|
316
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
317
|
+
before(:each) do
|
318
|
+
@test_file_size = @file_size
|
319
|
+
@expected_full_read_size = @file_size
|
320
|
+
@vfile_read_test_obj = @vfile_read_obj
|
321
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
322
|
+
@expected_returned_encoding = Encoding.default_external
|
323
|
+
|
324
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
325
|
+
end
|
326
|
+
|
327
|
+
after(:each) do
|
328
|
+
@rfile_obj.close
|
329
|
+
end
|
330
|
+
|
331
|
+
it_should_behave_like "common_each_each_codepoint"
|
332
|
+
end
|
333
|
+
|
334
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
335
|
+
before(:each) do
|
336
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
337
|
+
@expected_full_read_size = @test_file_size
|
338
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
339
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8")
|
340
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
341
|
+
|
342
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
343
|
+
end
|
344
|
+
|
345
|
+
after(:each) do
|
346
|
+
@vfile_read_test_obj.close
|
347
|
+
@rfile_obj.close
|
348
|
+
end
|
349
|
+
|
350
|
+
it_should_behave_like "common_each_each_codepoint"
|
351
|
+
end
|
352
|
+
|
353
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
354
|
+
before(:each) do
|
355
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
356
|
+
@expected_full_read_size = @test_file_size
|
357
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
358
|
+
@rfile_obj = VfsRealFile.new(@utf_16_filename, "rb:UTF-16LE")
|
359
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
360
|
+
|
361
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
362
|
+
end
|
363
|
+
|
364
|
+
after(:each) do
|
365
|
+
@vfile_read_test_obj.close
|
366
|
+
@rfile_obj.close
|
367
|
+
end
|
368
|
+
|
369
|
+
it_should_behave_like "common_each_each_codepoint"
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
describe "#getbyte - Buffer size: #{buf_sz}" do
|
374
|
+
context "Buffer size: #{buf_sz}" do
|
375
|
+
before(:each) do
|
376
|
+
@vfile_read_obj.send(:min_read_buf_sz=, buf_sz)
|
377
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
378
|
+
end
|
379
|
+
|
380
|
+
after(:each) do
|
381
|
+
@rfile_obj.close
|
382
|
+
end
|
383
|
+
|
384
|
+
it_should_behave_like "common_getbyte"
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
describe "#getc - Buffer size: #{buf_sz}" do
|
389
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
390
|
+
before(:each) do
|
391
|
+
@test_file_size = @file_size
|
392
|
+
@expected_full_read_size = @file_size
|
393
|
+
@vfile_read_test_obj = @vfile_read_obj
|
394
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
395
|
+
@expected_returned_encoding = Encoding.default_external
|
396
|
+
|
397
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
398
|
+
end
|
399
|
+
|
400
|
+
after(:each) do
|
401
|
+
@rfile_obj.close
|
402
|
+
end
|
403
|
+
|
404
|
+
it_should_behave_like "common_getc"
|
405
|
+
end
|
406
|
+
|
407
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
408
|
+
before(:each) do
|
409
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
410
|
+
@expected_full_read_size = @test_file_size
|
411
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
412
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8")
|
413
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
414
|
+
|
415
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
416
|
+
end
|
417
|
+
|
418
|
+
after(:each) do
|
419
|
+
@vfile_read_test_obj.close
|
420
|
+
@rfile_obj.close
|
421
|
+
end
|
422
|
+
|
423
|
+
it_should_behave_like "common_getc"
|
424
|
+
end
|
425
|
+
|
426
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
427
|
+
before(:each) do
|
428
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
429
|
+
@expected_full_read_size = @test_file_size
|
430
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
431
|
+
@rfile_obj = VfsRealFile.new(@utf_16_filename, "rb:UTF-16LE")
|
432
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
433
|
+
|
434
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
435
|
+
end
|
436
|
+
|
437
|
+
after(:each) do
|
438
|
+
@vfile_read_test_obj.close
|
439
|
+
@rfile_obj.close
|
440
|
+
end
|
441
|
+
|
442
|
+
it_should_behave_like "common_getc"
|
443
|
+
end
|
444
|
+
|
445
|
+
context "Transcode UTF-8 to UTF-16LE (buffer size: #{buf_sz})" do
|
446
|
+
before(:each) do
|
447
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
448
|
+
@expected_full_read_size = VfsRealFile.size(@utf_16_filename)
|
449
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
450
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
451
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
452
|
+
|
453
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
454
|
+
end
|
455
|
+
|
456
|
+
after(:each) do
|
457
|
+
@vfile_read_test_obj.close
|
458
|
+
@rfile_obj.close
|
459
|
+
end
|
460
|
+
|
461
|
+
it_should_behave_like "common_getc"
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
describe "#gets - Buffer size: #{buf_sz}" do
|
466
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
467
|
+
before(:each) do
|
468
|
+
@test_file_size = @file_size
|
469
|
+
@expected_full_read_size = @file_size
|
470
|
+
@vfile_read_test_obj = @vfile_read_obj
|
471
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
472
|
+
@expected_returned_encoding = Encoding.default_external
|
473
|
+
|
474
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
475
|
+
end
|
476
|
+
|
477
|
+
after(:each) do
|
478
|
+
@rfile_obj.close
|
479
|
+
end
|
480
|
+
|
481
|
+
it_should_behave_like "common_gets"
|
482
|
+
end
|
483
|
+
|
484
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
485
|
+
before(:each) do
|
486
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
487
|
+
@expected_full_read_size = @test_file_size
|
488
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
489
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8")
|
490
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
491
|
+
|
492
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
493
|
+
end
|
494
|
+
|
495
|
+
after(:each) do
|
496
|
+
@vfile_read_test_obj.close
|
497
|
+
@rfile_obj.close
|
498
|
+
end
|
499
|
+
|
500
|
+
it_should_behave_like "common_gets"
|
501
|
+
end
|
502
|
+
|
503
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
504
|
+
before(:each) do
|
505
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
506
|
+
@expected_full_read_size = @test_file_size
|
507
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
508
|
+
@rfile_obj = VfsRealFile.new(@utf_16_filename, "rb:UTF-16LE")
|
509
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
510
|
+
|
511
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
512
|
+
end
|
513
|
+
|
514
|
+
after(:each) do
|
515
|
+
@vfile_read_test_obj.close
|
516
|
+
@rfile_obj.close
|
517
|
+
end
|
518
|
+
|
519
|
+
it_should_behave_like "common_gets"
|
520
|
+
end
|
521
|
+
|
522
|
+
context "Transcode UTF-8 to UTF-16LE (buffer size: #{buf_sz})" do
|
523
|
+
before(:each) do
|
524
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
525
|
+
@expected_full_read_size = VfsRealFile.size(@utf_16_filename)
|
526
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
527
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
528
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
529
|
+
|
530
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
531
|
+
end
|
532
|
+
|
533
|
+
after(:each) do
|
534
|
+
@vfile_read_test_obj.close
|
535
|
+
@rfile_obj.close
|
536
|
+
end
|
537
|
+
|
538
|
+
it_should_behave_like "common_gets"
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
describe "#lines - Buffer size: #{buf_sz}" do # deprecated
|
543
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
544
|
+
before(:each) do
|
545
|
+
@test_file_size = @file_size
|
546
|
+
@expected_full_read_size = @file_size
|
547
|
+
@vfile_read_test_obj = @vfile_read_obj
|
548
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
549
|
+
@expected_returned_encoding = Encoding.default_external
|
550
|
+
|
551
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
552
|
+
end
|
553
|
+
|
554
|
+
after(:each) do
|
555
|
+
@rfile_obj.close
|
556
|
+
end
|
557
|
+
|
558
|
+
it_should_behave_like "common_lines"
|
559
|
+
end
|
560
|
+
|
561
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
562
|
+
before(:each) do
|
563
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
564
|
+
@expected_full_read_size = @test_file_size
|
565
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
566
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8")
|
567
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
568
|
+
|
569
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
570
|
+
end
|
571
|
+
|
572
|
+
after(:each) do
|
573
|
+
@vfile_read_test_obj.close
|
574
|
+
@rfile_obj.close
|
575
|
+
end
|
576
|
+
|
577
|
+
it_should_behave_like "common_lines"
|
578
|
+
end
|
579
|
+
|
580
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
581
|
+
before(:each) do
|
582
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
583
|
+
@expected_full_read_size = @test_file_size
|
584
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
585
|
+
@rfile_obj = VfsRealFile.new(@utf_16_filename, "rb:UTF-16LE")
|
586
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
587
|
+
|
588
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
589
|
+
end
|
590
|
+
|
591
|
+
after(:each) do
|
592
|
+
@vfile_read_test_obj.close
|
593
|
+
@rfile_obj.close
|
594
|
+
end
|
595
|
+
|
596
|
+
it_should_behave_like "common_lines"
|
597
|
+
end
|
598
|
+
|
599
|
+
context "Transcode UTF-8 to UTF-16LE (buffer size: #{buf_sz})" do
|
600
|
+
before(:each) do
|
601
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
602
|
+
@expected_full_read_size = VfsRealFile.size(@utf_16_filename)
|
603
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
604
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
605
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
606
|
+
|
607
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
608
|
+
end
|
609
|
+
|
610
|
+
after(:each) do
|
611
|
+
@vfile_read_test_obj.close
|
612
|
+
@rfile_obj.close
|
613
|
+
end
|
614
|
+
|
615
|
+
it_should_behave_like "common_lines"
|
616
|
+
end
|
617
|
+
end
|
618
|
+
|
619
|
+
describe "#read - Buffer size: #{buf_sz}" do
|
620
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
621
|
+
before(:each) do
|
622
|
+
@test_file_size = @file_size
|
623
|
+
@expected_full_read_size = @file_size
|
624
|
+
@vfile_read_test_obj = @vfile_read_obj
|
625
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
626
|
+
@expected_returned_encoding = Encoding.default_external
|
627
|
+
|
628
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
629
|
+
end
|
630
|
+
|
631
|
+
after(:each) do
|
632
|
+
@rfile_obj.close
|
633
|
+
end
|
634
|
+
|
635
|
+
it_should_behave_like "common_read"
|
636
|
+
end
|
637
|
+
|
638
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
639
|
+
before(:each) do
|
640
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
641
|
+
@expected_full_read_size = @test_file_size
|
642
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
643
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8")
|
644
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
645
|
+
|
646
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
647
|
+
end
|
648
|
+
|
649
|
+
after(:each) do
|
650
|
+
@vfile_read_test_obj.close
|
651
|
+
@rfile_obj.close
|
652
|
+
end
|
653
|
+
|
654
|
+
it_should_behave_like "common_read"
|
655
|
+
end
|
656
|
+
|
657
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
658
|
+
before(:each) do
|
659
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
660
|
+
@expected_full_read_size = @test_file_size
|
661
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
662
|
+
@rfile_obj = VfsRealFile.new(@utf_16_filename, "rb:UTF-16LE")
|
663
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
664
|
+
|
665
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
666
|
+
end
|
667
|
+
|
668
|
+
after(:each) do
|
669
|
+
@vfile_read_test_obj.close
|
670
|
+
@rfile_obj.close
|
671
|
+
end
|
672
|
+
|
673
|
+
it_should_behave_like "common_read"
|
674
|
+
end
|
675
|
+
|
676
|
+
context "Transcode UTF-8 to UTF-16LE (buffer size: #{buf_sz})" do
|
677
|
+
before(:each) do
|
678
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
679
|
+
@expected_full_read_size = VfsRealFile.size(@utf_16_filename)
|
680
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
681
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
682
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
683
|
+
|
684
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
685
|
+
end
|
686
|
+
|
687
|
+
after(:each) do
|
688
|
+
@vfile_read_test_obj.close
|
689
|
+
@rfile_obj.close
|
690
|
+
end
|
691
|
+
|
692
|
+
it_should_behave_like "common_read"
|
693
|
+
end
|
694
|
+
end
|
695
|
+
|
696
|
+
describe "#readlines - Buffer size: #{buf_sz}" do
|
697
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
698
|
+
before(:each) do
|
699
|
+
@test_file_size = @file_size
|
700
|
+
@expected_full_read_size = @file_size
|
701
|
+
@vfile_read_test_obj = @vfile_read_obj
|
702
|
+
@rfile_obj = VfsRealFile.new(@full_path, "r")
|
703
|
+
@expected_returned_encoding = Encoding.default_external
|
704
|
+
|
705
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
706
|
+
end
|
707
|
+
|
708
|
+
after(:each) do
|
709
|
+
@rfile_obj.close
|
710
|
+
end
|
711
|
+
|
712
|
+
it_should_behave_like "common_readlines"
|
713
|
+
end
|
714
|
+
|
715
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
716
|
+
before(:each) do
|
717
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
718
|
+
@expected_full_read_size = @test_file_size
|
719
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
720
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8")
|
721
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
722
|
+
|
723
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
724
|
+
end
|
725
|
+
|
726
|
+
after(:each) do
|
727
|
+
@vfile_read_test_obj.close
|
728
|
+
@rfile_obj.close
|
729
|
+
end
|
730
|
+
|
731
|
+
it_should_behave_like "common_readlines"
|
732
|
+
end
|
733
|
+
|
734
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
735
|
+
before(:each) do
|
736
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
737
|
+
@expected_full_read_size = @test_file_size
|
738
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
739
|
+
@rfile_obj = VfsRealFile.new(@utf_16_filename, "rb:UTF-16LE")
|
740
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
741
|
+
|
742
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
743
|
+
end
|
744
|
+
|
745
|
+
after(:each) do
|
746
|
+
@vfile_read_test_obj.close
|
747
|
+
@rfile_obj.close
|
748
|
+
end
|
749
|
+
|
750
|
+
it_should_behave_like "common_readlines"
|
751
|
+
end
|
752
|
+
|
753
|
+
context "Transcode UTF-8 to UTF-16LE (buffer size: #{buf_sz})" do
|
754
|
+
before(:each) do
|
755
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
756
|
+
@expected_full_read_size = VfsRealFile.size(@utf_16_filename)
|
757
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
758
|
+
@rfile_obj = VfsRealFile.new(@utf_8_filename, "r:UTF-8:UTF-16LE")
|
759
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
760
|
+
|
761
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
762
|
+
end
|
763
|
+
|
764
|
+
after(:each) do
|
765
|
+
@vfile_read_test_obj.close
|
766
|
+
@rfile_obj.close
|
767
|
+
end
|
768
|
+
|
769
|
+
it_should_behave_like "common_readlines"
|
770
|
+
end
|
771
|
+
end
|
772
|
+
|
773
|
+
describe "#ungetbyte - Buffer size: #{buf_sz}" do
|
774
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
775
|
+
before(:each) do
|
776
|
+
@test_file_size = @file_size
|
777
|
+
@vfile_read_test_obj = @vfile_read_obj
|
778
|
+
@expected_returned_encoding = Encoding.default_external
|
779
|
+
|
780
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
781
|
+
|
782
|
+
@char = "X"
|
783
|
+
@bytes_for_char = @char.dup.force_encoding("ASCII-8BIT")
|
784
|
+
@expected_return_char = @char
|
785
|
+
end
|
786
|
+
|
787
|
+
it_should_behave_like "common_ungetbyte"
|
788
|
+
end
|
789
|
+
|
790
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
791
|
+
before(:each) do
|
792
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
793
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
794
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
795
|
+
|
796
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
797
|
+
|
798
|
+
@char = "X".encode("UTF-8")
|
799
|
+
@bytes_for_char = @char.dup.force_encoding("ASCII-8BIT")
|
800
|
+
@expected_return_char = @char
|
801
|
+
end
|
802
|
+
|
803
|
+
it_should_behave_like "common_ungetbyte"
|
804
|
+
end
|
805
|
+
|
806
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
807
|
+
before(:each) do
|
808
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
809
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE")
|
810
|
+
@expected_returned_encoding = Encoding.find("UTF-16LE")
|
811
|
+
|
812
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
813
|
+
|
814
|
+
@char = "X".encode("UTF-16LE")
|
815
|
+
@bytes_for_char = @char.dup.force_encoding("ASCII-8BIT")
|
816
|
+
@expected_return_char = @char
|
817
|
+
end
|
818
|
+
|
819
|
+
it_should_behave_like "common_ungetbyte"
|
820
|
+
end
|
821
|
+
end
|
822
|
+
|
823
|
+
describe "#ungetc - Buffer size: #{buf_sz}" do
|
824
|
+
context "default encoding (buffer size: #{buf_sz})" do
|
825
|
+
before(:each) do
|
826
|
+
@test_file_size = @file_size
|
827
|
+
@vfile_read_test_obj = @vfile_read_obj
|
828
|
+
@expected_returned_encoding = Encoding.default_external
|
829
|
+
|
830
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
831
|
+
end
|
832
|
+
|
833
|
+
it_should_behave_like "common_ungetc"
|
834
|
+
end
|
835
|
+
|
836
|
+
context "UTF-8 encoding (buffer size: #{buf_sz})" do
|
837
|
+
before(:each) do
|
838
|
+
@test_file_size = VfsRealFile.size(@utf_8_filename)
|
839
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_8_filename, "r:UTF-8")
|
840
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
841
|
+
|
842
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
843
|
+
end
|
844
|
+
|
845
|
+
it_should_behave_like "common_ungetc"
|
846
|
+
end
|
847
|
+
|
848
|
+
context "UTF-16LE encoding (buffer size: #{buf_sz})" do
|
849
|
+
before(:each) do
|
850
|
+
@test_file_size = VfsRealFile.size(@utf_16_filename)
|
851
|
+
@vfile_read_test_obj = VirtFS::VFile.new(@utf_16_filename, "rb:UTF-16LE:UTF-8")
|
852
|
+
@expected_returned_encoding = Encoding.find("UTF-8")
|
853
|
+
|
854
|
+
@vfile_read_test_obj.send(:min_read_buf_sz=, buf_sz)
|
855
|
+
end
|
856
|
+
|
857
|
+
it_should_behave_like "common_ungetc"
|
858
|
+
end
|
859
|
+
end
|
860
|
+
end
|
861
|
+
end
|