virtfs 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,154 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe VirtFS::VFile, "(#{$fs_interface} interface)" do
|
4
|
+
before(:all) do
|
5
|
+
@spec_name = VfsRealFile.basename(__FILE__, ".rb")
|
6
|
+
@temp_prefix = "#{@spec_name}-"
|
7
|
+
|
8
|
+
@ext = ".rb"
|
9
|
+
@data1 = "0123456789" * 4
|
10
|
+
@temp_file = Tempfile.new(["VirtFS-File", @ext])
|
11
|
+
@temp_file.write(@data1)
|
12
|
+
@temp_file.close
|
13
|
+
@full_path = @temp_file.path
|
14
|
+
@rel_path = File.basename(@full_path)
|
15
|
+
@parent_dir = File.dirname(@full_path)
|
16
|
+
|
17
|
+
@ext2 = ".c"
|
18
|
+
@temp_file2 = Tempfile.new(["VirtFS-File", @ext2])
|
19
|
+
@temp_file2.close
|
20
|
+
@full_path2 = @temp_file2.path
|
21
|
+
@rel_path2 = File.basename(@full_path2)
|
22
|
+
@parent_dir2 = File.dirname(@full_path2)
|
23
|
+
|
24
|
+
@slink_path = temp_name(@temp_prefix, ".symlink")
|
25
|
+
|
26
|
+
@root = File::SEPARATOR
|
27
|
+
@this_dir = VfsRealDir.getwd
|
28
|
+
end
|
29
|
+
|
30
|
+
before(:each) do
|
31
|
+
reset_context
|
32
|
+
|
33
|
+
@native_fs = nativefs_class.new
|
34
|
+
VirtFS.mount(@native_fs, @root)
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#atime" do
|
38
|
+
it "should return the same value as the standard File#atime method" do
|
39
|
+
VfsRealFile.open(@full_path) do |rf|
|
40
|
+
VirtFS::VFile.open(@full_path) { |vf| expect(vf.atime).to eq(rf.atime) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#chmod" do
|
46
|
+
it "should return 0" do
|
47
|
+
VirtFS::VFile.open(@full_path) do |vf|
|
48
|
+
expect(vf.chmod(0777)).to eq(0)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should change the permission bits on the file" do
|
53
|
+
target_mode = 0755
|
54
|
+
expect(VfsRealFile.stat(@full_path).mode & 0777).to_not eq(target_mode)
|
55
|
+
VirtFS::VFile.open(@full_path) do |vf|
|
56
|
+
expect(vf.chmod(target_mode)).to be_zero
|
57
|
+
end
|
58
|
+
expect(VfsRealFile.stat(@full_path).mode & 0777).to eq(target_mode)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "#chown" do
|
63
|
+
it "should return 0 on success" do
|
64
|
+
stat = VfsRealFile.stat(@full_path)
|
65
|
+
|
66
|
+
VirtFS::VFile.open(@full_path) do |vf|
|
67
|
+
expect(vf.chown(stat.uid, stat.gid)).to eq(0)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "#ctime" do
|
73
|
+
it "should return the same value as the standard File#ctime method" do
|
74
|
+
VfsRealFile.open(@full_path) do |rf|
|
75
|
+
VirtFS::VFile.open(@full_path) { |vf| expect(vf.ctime).to eq(rf.ctime) }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "#flock" do
|
81
|
+
it "should return 0" do
|
82
|
+
VirtFS::VFile.open(@full_path) do |vf|
|
83
|
+
expect(vf.flock(File::LOCK_EX)).to eq(0)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#lstat" do
|
89
|
+
before(:each) do
|
90
|
+
VfsRealFile.symlink(@full_path, @slink_path)
|
91
|
+
end
|
92
|
+
|
93
|
+
after(:each) do
|
94
|
+
VfsRealFile.delete(@slink_path)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should return the stat information for the symlink" do
|
98
|
+
VirtFS::VFile.open(@slink_path) do |sl|
|
99
|
+
expect(sl.lstat.symlink?).to be true
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "#mtime" do
|
105
|
+
it "should return the same value as the standard File#mtime method" do
|
106
|
+
VfsRealFile.open(@full_path) do |rf|
|
107
|
+
VirtFS::VFile.open(@full_path) { |vf| expect(vf.mtime).to eq(rf.mtime) }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe "#path :to_path" do
|
113
|
+
it "should return full path when opened with full path" do
|
114
|
+
VirtFS::VFile.open(@full_path) { |f| expect(f.path).to eq(@full_path) }
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should return relative path when opened with relative path" do
|
118
|
+
parent, target_file = VfsRealFile.split(@full_path)
|
119
|
+
VirtFS::VDir.chdir(parent)
|
120
|
+
VirtFS::VFile.open(target_file) { |f| expect(f.path).to eq(target_file) }
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe "#size" do
|
125
|
+
it "should return the known size of the file" do
|
126
|
+
VirtFS::VFile.open(@full_path) { |f| expect(f.size).to eq(@data1.bytesize) }
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should return the same value as the standard File#size" do
|
130
|
+
VfsRealFile.open(@full_path) do |rf|
|
131
|
+
VirtFS::VFile.open(@full_path) { |vf| expect(vf.size).to eq(rf.size) }
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe "#truncate" do
|
137
|
+
it "should return 0" do
|
138
|
+
VirtFS::VFile.open(@full_path, "w") { |f| expect(f.truncate(5)).to eq(0) }
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should raise IOError when file isn't open for writing" do
|
142
|
+
VirtFS::VFile.open(@full_path, "r") do |f|
|
143
|
+
expect { f.truncate(0) }.to raise_error(IOError, "not opened for writing")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should truncate the file to the specified size" do
|
148
|
+
tsize = @data1.bytesize / 2
|
149
|
+
expect(VfsRealFile.size(@full_path)).to_not eq(tsize)
|
150
|
+
VirtFS::VFile.open(@full_path, "w") { |f| f.truncate(tsize) }
|
151
|
+
expect(VfsRealFile.size(@full_path)).to eq(tsize)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,1556 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
#
|
4
|
+
# *args --> mode="r" <,permission> <,options>
|
5
|
+
# mode --> String or Integer
|
6
|
+
# permission --> Integer
|
7
|
+
# options --> Hash
|
8
|
+
#
|
9
|
+
# 1 arg: <mode | options>
|
10
|
+
# 2 args: mode, <permissions | options>
|
11
|
+
# 3 args: mode, permissions, options
|
12
|
+
#
|
13
|
+
# mode string --> file-mode[:external-encoding[:internal-encoding]]
|
14
|
+
#
|
15
|
+
# file-mode mapped to binary:
|
16
|
+
# "r" --> File::RDONLY
|
17
|
+
# "r+" --> File::RDWR
|
18
|
+
# "w" --> File::WRONLY | File::TRUNC | File::CREAT
|
19
|
+
# "w+" --> File::RDWR | File::TRUNC | File::CREAT
|
20
|
+
# "a" --> File::WRONLY | File::APPEND | File::CREAT
|
21
|
+
# "a+" --> File::RDWR | File::APPEND | File::CREAT
|
22
|
+
#
|
23
|
+
# Options:
|
24
|
+
# :autoclose => If false, the underlying file will not be closed
|
25
|
+
# when this I/O object is finalized.
|
26
|
+
#
|
27
|
+
# :binmode => Opens the IO object in binary mode if true (same as mode: "b").
|
28
|
+
#
|
29
|
+
# :encoding => Specifies both external and internal encodings
|
30
|
+
# as "external:internal" (same format used in mode parameter).
|
31
|
+
#
|
32
|
+
# :external_encoding => Specifies the external encoding.
|
33
|
+
#
|
34
|
+
# :internal_encoding => Specifies the internal encoding.
|
35
|
+
#
|
36
|
+
# :mode => Specifies what would have been the mode parameter.
|
37
|
+
#
|
38
|
+
# :textmode => Open the file in text mode (the default).
|
39
|
+
#
|
40
|
+
describe VirtFS::FileModesAndOptions, "(#{$fs_interface} interface)" do # rubocop:disable Style/GlobalVars
|
41
|
+
before(:each) do
|
42
|
+
reset_context
|
43
|
+
end
|
44
|
+
|
45
|
+
context "modes" do
|
46
|
+
context "default" do
|
47
|
+
before(:each) do
|
48
|
+
@fmo = VirtFS::FileModesAndOptions.new
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "mode_bits" do
|
52
|
+
it "should return File::RDONLY" do
|
53
|
+
expect(@fmo.mode_bits).to eq(File::RDONLY)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "external_encoding" do
|
58
|
+
it "should return Encoding.default_external" do
|
59
|
+
expect(@fmo.external_encoding).to eq(Encoding.default_external)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "internal_encoding" do
|
64
|
+
it "should return Encoding.default_internal" do
|
65
|
+
expect(@fmo.internal_encoding).to eq(Encoding.default_internal)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "permissions" do
|
70
|
+
it "should return nil" do
|
71
|
+
expect(@fmo.permissions).to eq(nil)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "append?" do
|
76
|
+
it "should return false" do
|
77
|
+
expect(@fmo.append?).to be false
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "binmode?" do
|
82
|
+
it "should return false" do
|
83
|
+
expect(@fmo.binmode?).to be false
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "create?" do
|
88
|
+
it "should return false" do
|
89
|
+
expect(@fmo.create?).to be false
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe "excl?" do
|
94
|
+
it "should return false" do
|
95
|
+
expect(@fmo.excl?).to be false
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "noctty?" do
|
100
|
+
it "should return false" do
|
101
|
+
expect(@fmo.noctty?).to be false
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "nonblock?" do
|
106
|
+
it "should return false" do
|
107
|
+
expect(@fmo.nonblock?).to be false
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "rdonly?" do
|
112
|
+
it "should return true" do
|
113
|
+
expect(@fmo.rdonly?).to be true
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "rdwr?" do
|
118
|
+
it "should return false" do
|
119
|
+
expect(@fmo.rdwr?).to be false
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "trunc?" do
|
124
|
+
it "should return false" do
|
125
|
+
expect(@fmo.trunc?).to be false
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe "wronly?" do
|
130
|
+
it "should return false" do
|
131
|
+
expect(@fmo.wronly?).to be false
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
context "default + binmode = 'b'" do
|
137
|
+
before(:each) do
|
138
|
+
@fmo = VirtFS::FileModesAndOptions.new("b")
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "mode_bits" do
|
142
|
+
it "should return File::RDONLY" do
|
143
|
+
expect(@fmo.mode_bits).to eq(File::RDONLY)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
describe "append?" do
|
148
|
+
it "should return false" do
|
149
|
+
expect(@fmo.append?).to be false
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "binmode?" do
|
154
|
+
it "should return true" do
|
155
|
+
expect(@fmo.binmode?).to be true
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe "create?" do
|
160
|
+
it "should return false" do
|
161
|
+
expect(@fmo.create?).to be false
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe "excl?" do
|
166
|
+
it "should return false" do
|
167
|
+
expect(@fmo.excl?).to be false
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
describe "noctty?" do
|
172
|
+
it "should return false" do
|
173
|
+
expect(@fmo.noctty?).to be false
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
describe "nonblock?" do
|
178
|
+
it "should return false" do
|
179
|
+
expect(@fmo.nonblock?).to be false
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
describe "rdonly?" do
|
184
|
+
it "should return true" do
|
185
|
+
expect(@fmo.rdonly?).to be true
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
describe "rdwr?" do
|
190
|
+
it "should return false" do
|
191
|
+
expect(@fmo.rdwr?).to be false
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe "trunc?" do
|
196
|
+
it "should return false" do
|
197
|
+
expect(@fmo.trunc?).to be false
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
describe "wronly?" do
|
202
|
+
it "should return false" do
|
203
|
+
expect(@fmo.wronly?).to be false
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
context "read only = 'r'" do
|
209
|
+
before(:each) do
|
210
|
+
@fmo = VirtFS::FileModesAndOptions.new("r")
|
211
|
+
end
|
212
|
+
|
213
|
+
describe "mode_bits" do
|
214
|
+
it "should return File::RDONLY" do
|
215
|
+
expect(@fmo.mode_bits).to eq(File::RDONLY)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
describe "append?" do
|
220
|
+
it "should return false" do
|
221
|
+
expect(@fmo.append?).to be false
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
describe "binmode?" do
|
226
|
+
it "should return false" do
|
227
|
+
expect(@fmo.binmode?).to be false
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
describe "create?" do
|
232
|
+
it "should return false" do
|
233
|
+
expect(@fmo.create?).to be false
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
describe "excl?" do
|
238
|
+
it "should return false" do
|
239
|
+
expect(@fmo.excl?).to be false
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
describe "noctty?" do
|
244
|
+
it "should return false" do
|
245
|
+
expect(@fmo.noctty?).to be false
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
describe "nonblock?" do
|
250
|
+
it "should return false" do
|
251
|
+
expect(@fmo.nonblock?).to be false
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
describe "rdonly?" do
|
256
|
+
it "should return true" do
|
257
|
+
expect(@fmo.rdonly?).to be true
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
describe "rdwr?" do
|
262
|
+
it "should return false" do
|
263
|
+
expect(@fmo.rdwr?).to be false
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
describe "trunc?" do
|
268
|
+
it "should return false" do
|
269
|
+
expect(@fmo.trunc?).to be false
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
describe "wronly?" do
|
274
|
+
it "should return false" do
|
275
|
+
expect(@fmo.wronly?).to be false
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
context "read only + binmode = 'rb'" do
|
281
|
+
before(:each) do
|
282
|
+
@fmo = VirtFS::FileModesAndOptions.new("rb")
|
283
|
+
end
|
284
|
+
|
285
|
+
describe "mode_bits" do
|
286
|
+
it "should return File::RDONLY" do
|
287
|
+
expect(@fmo.mode_bits).to eq(File::RDONLY)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
describe "append?" do
|
292
|
+
it "should return false" do
|
293
|
+
expect(@fmo.append?).to be false
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
describe "binmode?" do
|
298
|
+
it "should return true" do
|
299
|
+
expect(@fmo.binmode?).to be true
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
describe "create?" do
|
304
|
+
it "should return false" do
|
305
|
+
expect(@fmo.create?).to be false
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
describe "excl?" do
|
310
|
+
it "should return false" do
|
311
|
+
expect(@fmo.excl?).to be false
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
describe "noctty?" do
|
316
|
+
it "should return false" do
|
317
|
+
expect(@fmo.noctty?).to be false
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
describe "nonblock?" do
|
322
|
+
it "should return false" do
|
323
|
+
expect(@fmo.nonblock?).to be false
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
describe "rdonly?" do
|
328
|
+
it "should return true" do
|
329
|
+
expect(@fmo.rdonly?).to be true
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
describe "rdwr?" do
|
334
|
+
it "should return false" do
|
335
|
+
expect(@fmo.rdwr?).to be false
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
describe "trunc?" do
|
340
|
+
it "should return false" do
|
341
|
+
expect(@fmo.trunc?).to be false
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
describe "wronly?" do
|
346
|
+
it "should return false" do
|
347
|
+
expect(@fmo.wronly?).to be false
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
context "read write = 'r+'" do
|
353
|
+
before(:each) do
|
354
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+")
|
355
|
+
end
|
356
|
+
|
357
|
+
describe "mode_bits" do
|
358
|
+
it "should return File::RDWR" do
|
359
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
describe "append?" do
|
364
|
+
it "should return false" do
|
365
|
+
expect(@fmo.append?).to be false
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
describe "binmode?" do
|
370
|
+
it "should return false" do
|
371
|
+
expect(@fmo.binmode?).to be false
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
describe "create?" do
|
376
|
+
it "should return false" do
|
377
|
+
expect(@fmo.create?).to be false
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
describe "excl?" do
|
382
|
+
it "should return false" do
|
383
|
+
expect(@fmo.excl?).to be false
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
describe "noctty?" do
|
388
|
+
it "should return false" do
|
389
|
+
expect(@fmo.noctty?).to be false
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
describe "nonblock?" do
|
394
|
+
it "should return false" do
|
395
|
+
expect(@fmo.nonblock?).to be false
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
describe "rdonly?" do
|
400
|
+
it "should return false" do
|
401
|
+
expect(@fmo.rdonly?).to be false
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
describe "rdwr?" do
|
406
|
+
it "should return true" do
|
407
|
+
expect(@fmo.rdwr?).to be true
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
describe "trunc?" do
|
412
|
+
it "should return false" do
|
413
|
+
expect(@fmo.trunc?).to be false
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
describe "wronly?" do
|
418
|
+
it "should return false" do
|
419
|
+
expect(@fmo.wronly?).to be false
|
420
|
+
end
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
context "read write + binmode = 'r+b'" do
|
425
|
+
before(:each) do
|
426
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+b")
|
427
|
+
end
|
428
|
+
|
429
|
+
describe "mode_bits" do
|
430
|
+
it "should return File::RDWR" do
|
431
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
describe "append?" do
|
436
|
+
it "should return false" do
|
437
|
+
expect(@fmo.append?).to be false
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
describe "binmode?" do
|
442
|
+
it "should return true" do
|
443
|
+
expect(@fmo.binmode?).to be true
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
describe "create?" do
|
448
|
+
it "should return false" do
|
449
|
+
expect(@fmo.create?).to be false
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
describe "excl?" do
|
454
|
+
it "should return false" do
|
455
|
+
expect(@fmo.excl?).to be false
|
456
|
+
end
|
457
|
+
end
|
458
|
+
|
459
|
+
describe "noctty?" do
|
460
|
+
it "should return false" do
|
461
|
+
expect(@fmo.noctty?).to be false
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
describe "nonblock?" do
|
466
|
+
it "should return false" do
|
467
|
+
expect(@fmo.nonblock?).to be false
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
describe "rdonly?" do
|
472
|
+
it "should return false" do
|
473
|
+
expect(@fmo.rdonly?).to be false
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
describe "rdwr?" do
|
478
|
+
it "should return true" do
|
479
|
+
expect(@fmo.rdwr?).to be true
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
describe "trunc?" do
|
484
|
+
it "should return false" do
|
485
|
+
expect(@fmo.trunc?).to be false
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
describe "wronly?" do
|
490
|
+
it "should return false" do
|
491
|
+
expect(@fmo.wronly?).to be false
|
492
|
+
end
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
context "write only, truncate, create = 'w'" do
|
497
|
+
before(:each) do
|
498
|
+
@fmo = VirtFS::FileModesAndOptions.new("w")
|
499
|
+
end
|
500
|
+
|
501
|
+
describe "mode_bits" do
|
502
|
+
it "should return (File::WRONLY | File::TRUNC | File::CREAT)" do
|
503
|
+
expect(@fmo.mode_bits).to eq(File::WRONLY | File::TRUNC | File::CREAT)
|
504
|
+
end
|
505
|
+
end
|
506
|
+
|
507
|
+
describe "append?" do
|
508
|
+
it "should return false" do
|
509
|
+
expect(@fmo.append?).to be false
|
510
|
+
end
|
511
|
+
end
|
512
|
+
|
513
|
+
describe "binmode?" do
|
514
|
+
it "should return false" do
|
515
|
+
expect(@fmo.binmode?).to be false
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
describe "create?" do
|
520
|
+
it "should return true" do
|
521
|
+
expect(@fmo.create?).to be true
|
522
|
+
end
|
523
|
+
end
|
524
|
+
|
525
|
+
describe "excl?" do
|
526
|
+
it "should return false" do
|
527
|
+
expect(@fmo.excl?).to be false
|
528
|
+
end
|
529
|
+
end
|
530
|
+
|
531
|
+
describe "noctty?" do
|
532
|
+
it "should return false" do
|
533
|
+
expect(@fmo.noctty?).to be false
|
534
|
+
end
|
535
|
+
end
|
536
|
+
|
537
|
+
describe "nonblock?" do
|
538
|
+
it "should return false" do
|
539
|
+
expect(@fmo.nonblock?).to be false
|
540
|
+
end
|
541
|
+
end
|
542
|
+
|
543
|
+
describe "rdonly?" do
|
544
|
+
it "should return false" do
|
545
|
+
expect(@fmo.rdonly?).to be false
|
546
|
+
end
|
547
|
+
end
|
548
|
+
|
549
|
+
describe "rdwr?" do
|
550
|
+
it "should return false" do
|
551
|
+
expect(@fmo.rdwr?).to be false
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
describe "trunc?" do
|
556
|
+
it "should return true" do
|
557
|
+
expect(@fmo.trunc?).to be true
|
558
|
+
end
|
559
|
+
end
|
560
|
+
|
561
|
+
describe "wronly?" do
|
562
|
+
it "should return true" do
|
563
|
+
expect(@fmo.wronly?).to be true
|
564
|
+
end
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
568
|
+
context "read write, truncate, create = 'w+'" do
|
569
|
+
before(:each) do
|
570
|
+
@fmo = VirtFS::FileModesAndOptions.new("w+")
|
571
|
+
end
|
572
|
+
|
573
|
+
describe "mode_bits" do
|
574
|
+
it "should return (File::RDWR | File::TRUNC | File::CREAT)" do
|
575
|
+
expect(@fmo.mode_bits).to eq(File::RDWR | File::TRUNC | File::CREAT)
|
576
|
+
end
|
577
|
+
end
|
578
|
+
|
579
|
+
describe "append?" do
|
580
|
+
it "should return false" do
|
581
|
+
expect(@fmo.append?).to be false
|
582
|
+
end
|
583
|
+
end
|
584
|
+
|
585
|
+
describe "binmode?" do
|
586
|
+
it "should return false" do
|
587
|
+
expect(@fmo.binmode?).to be false
|
588
|
+
end
|
589
|
+
end
|
590
|
+
|
591
|
+
describe "create?" do
|
592
|
+
it "should return true" do
|
593
|
+
expect(@fmo.create?).to be true
|
594
|
+
end
|
595
|
+
end
|
596
|
+
|
597
|
+
describe "excl?" do
|
598
|
+
it "should return false" do
|
599
|
+
expect(@fmo.excl?).to be false
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
describe "noctty?" do
|
604
|
+
it "should return false" do
|
605
|
+
expect(@fmo.noctty?).to be false
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
describe "nonblock?" do
|
610
|
+
it "should return false" do
|
611
|
+
expect(@fmo.nonblock?).to be false
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
615
|
+
describe "rdonly?" do
|
616
|
+
it "should return false" do
|
617
|
+
expect(@fmo.rdonly?).to be false
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
621
|
+
describe "rdwr?" do
|
622
|
+
it "should return true" do
|
623
|
+
expect(@fmo.rdwr?).to be true
|
624
|
+
end
|
625
|
+
end
|
626
|
+
|
627
|
+
describe "trunc?" do
|
628
|
+
it "should return true" do
|
629
|
+
expect(@fmo.trunc?).to be true
|
630
|
+
end
|
631
|
+
end
|
632
|
+
|
633
|
+
describe "wronly?" do
|
634
|
+
it "should return false" do
|
635
|
+
expect(@fmo.wronly?).to be false
|
636
|
+
end
|
637
|
+
end
|
638
|
+
end
|
639
|
+
|
640
|
+
context "write only, append, create = 'a'" do
|
641
|
+
before(:each) do
|
642
|
+
@fmo = VirtFS::FileModesAndOptions.new("a")
|
643
|
+
end
|
644
|
+
|
645
|
+
describe "mode_bits" do
|
646
|
+
it "should return (File::WRONLY | File::APPEND | File::CREAT)" do
|
647
|
+
expect(@fmo.mode_bits).to eq(File::WRONLY | File::APPEND | File::CREAT)
|
648
|
+
end
|
649
|
+
end
|
650
|
+
|
651
|
+
describe "append?" do
|
652
|
+
it "should return true" do
|
653
|
+
expect(@fmo.append?).to be true
|
654
|
+
end
|
655
|
+
end
|
656
|
+
|
657
|
+
describe "binmode?" do
|
658
|
+
it "should return false" do
|
659
|
+
expect(@fmo.binmode?).to be false
|
660
|
+
end
|
661
|
+
end
|
662
|
+
|
663
|
+
describe "create?" do
|
664
|
+
it "should return true" do
|
665
|
+
expect(@fmo.create?).to be true
|
666
|
+
end
|
667
|
+
end
|
668
|
+
|
669
|
+
describe "excl?" do
|
670
|
+
it "should return false" do
|
671
|
+
expect(@fmo.excl?).to be false
|
672
|
+
end
|
673
|
+
end
|
674
|
+
|
675
|
+
describe "noctty?" do
|
676
|
+
it "should return false" do
|
677
|
+
expect(@fmo.noctty?).to be false
|
678
|
+
end
|
679
|
+
end
|
680
|
+
|
681
|
+
describe "nonblock?" do
|
682
|
+
it "should return false" do
|
683
|
+
expect(@fmo.nonblock?).to be false
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
describe "rdonly?" do
|
688
|
+
it "should return false" do
|
689
|
+
expect(@fmo.rdonly?).to be false
|
690
|
+
end
|
691
|
+
end
|
692
|
+
|
693
|
+
describe "rdwr?" do
|
694
|
+
it "should return false" do
|
695
|
+
expect(@fmo.rdwr?).to be false
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
699
|
+
describe "trunc?" do
|
700
|
+
it "should return false" do
|
701
|
+
expect(@fmo.trunc?).to be false
|
702
|
+
end
|
703
|
+
end
|
704
|
+
|
705
|
+
describe "wronly?" do
|
706
|
+
it "should return true" do
|
707
|
+
expect(@fmo.wronly?).to be true
|
708
|
+
end
|
709
|
+
end
|
710
|
+
end
|
711
|
+
|
712
|
+
context "read write, append, create = 'a+'" do
|
713
|
+
before(:each) do
|
714
|
+
@fmo = VirtFS::FileModesAndOptions.new("a+")
|
715
|
+
end
|
716
|
+
|
717
|
+
describe "mode_bits" do
|
718
|
+
it "should return (File::RDWR | File::APPEND | File::CREAT)" do
|
719
|
+
expect(@fmo.mode_bits).to eq(File::RDWR | File::APPEND | File::CREAT)
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
describe "append?" do
|
724
|
+
it "should return true" do
|
725
|
+
expect(@fmo.append?).to be true
|
726
|
+
end
|
727
|
+
end
|
728
|
+
|
729
|
+
describe "binmode?" do
|
730
|
+
it "should return false" do
|
731
|
+
expect(@fmo.binmode?).to be false
|
732
|
+
end
|
733
|
+
end
|
734
|
+
|
735
|
+
describe "create?" do
|
736
|
+
it "should return true" do
|
737
|
+
expect(@fmo.create?).to be true
|
738
|
+
end
|
739
|
+
end
|
740
|
+
|
741
|
+
describe "excl?" do
|
742
|
+
it "should return false" do
|
743
|
+
expect(@fmo.excl?).to be false
|
744
|
+
end
|
745
|
+
end
|
746
|
+
|
747
|
+
describe "noctty?" do
|
748
|
+
it "should return false" do
|
749
|
+
expect(@fmo.noctty?).to be false
|
750
|
+
end
|
751
|
+
end
|
752
|
+
|
753
|
+
describe "nonblock?" do
|
754
|
+
it "should return false" do
|
755
|
+
expect(@fmo.nonblock?).to be false
|
756
|
+
end
|
757
|
+
end
|
758
|
+
|
759
|
+
describe "rdonly?" do
|
760
|
+
it "should return false" do
|
761
|
+
expect(@fmo.rdonly?).to be false
|
762
|
+
end
|
763
|
+
end
|
764
|
+
|
765
|
+
describe "rdwr?" do
|
766
|
+
it "should return true" do
|
767
|
+
expect(@fmo.rdwr?).to be true
|
768
|
+
end
|
769
|
+
end
|
770
|
+
|
771
|
+
describe "trunc?" do
|
772
|
+
it "should return false" do
|
773
|
+
expect(@fmo.trunc?).to be false
|
774
|
+
end
|
775
|
+
end
|
776
|
+
|
777
|
+
describe "wronly?" do
|
778
|
+
it "should return false" do
|
779
|
+
expect(@fmo.wronly?).to be false
|
780
|
+
end
|
781
|
+
end
|
782
|
+
end
|
783
|
+
|
784
|
+
context "with encoding" do
|
785
|
+
context "external encoding" do
|
786
|
+
before(:each) do
|
787
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+:ascii-8bit")
|
788
|
+
end
|
789
|
+
|
790
|
+
it "should set the external encoding to a value other than the default" do
|
791
|
+
new_encoding = Encoding.find("ascii-8bit")
|
792
|
+
expect(new_encoding).not_to eq(Encoding.default_external)
|
793
|
+
expect(@fmo.external_encoding).to eq(new_encoding)
|
794
|
+
end
|
795
|
+
|
796
|
+
describe "mode_bits" do
|
797
|
+
it "should return File::RDWR" do
|
798
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
799
|
+
end
|
800
|
+
end
|
801
|
+
|
802
|
+
describe "append?" do
|
803
|
+
it "should return false" do
|
804
|
+
expect(@fmo.append?).to be false
|
805
|
+
end
|
806
|
+
end
|
807
|
+
|
808
|
+
describe "binmode?" do
|
809
|
+
it "should return false" do
|
810
|
+
expect(@fmo.binmode?).to be false
|
811
|
+
end
|
812
|
+
end
|
813
|
+
|
814
|
+
describe "create?" do
|
815
|
+
it "should return false" do
|
816
|
+
expect(@fmo.create?).to be false
|
817
|
+
end
|
818
|
+
end
|
819
|
+
|
820
|
+
describe "excl?" do
|
821
|
+
it "should return false" do
|
822
|
+
expect(@fmo.excl?).to be false
|
823
|
+
end
|
824
|
+
end
|
825
|
+
|
826
|
+
describe "noctty?" do
|
827
|
+
it "should return false" do
|
828
|
+
expect(@fmo.noctty?).to be false
|
829
|
+
end
|
830
|
+
end
|
831
|
+
|
832
|
+
describe "nonblock?" do
|
833
|
+
it "should return false" do
|
834
|
+
expect(@fmo.nonblock?).to be false
|
835
|
+
end
|
836
|
+
end
|
837
|
+
|
838
|
+
describe "rdonly?" do
|
839
|
+
it "should return false" do
|
840
|
+
expect(@fmo.rdonly?).to be false
|
841
|
+
end
|
842
|
+
end
|
843
|
+
|
844
|
+
describe "rdwr?" do
|
845
|
+
it "should return true" do
|
846
|
+
expect(@fmo.rdwr?).to be true
|
847
|
+
end
|
848
|
+
end
|
849
|
+
|
850
|
+
describe "trunc?" do
|
851
|
+
it "should return false" do
|
852
|
+
expect(@fmo.trunc?).to be false
|
853
|
+
end
|
854
|
+
end
|
855
|
+
|
856
|
+
describe "wronly?" do
|
857
|
+
it "should return false" do
|
858
|
+
expect(@fmo.wronly?).to be false
|
859
|
+
end
|
860
|
+
end
|
861
|
+
end
|
862
|
+
|
863
|
+
context "internal encoding" do
|
864
|
+
before(:each) do
|
865
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+::utf-8")
|
866
|
+
end
|
867
|
+
|
868
|
+
it "should set the internal encoding to a value other than the default" do
|
869
|
+
new_encoding = Encoding.find("utf-8")
|
870
|
+
expect(new_encoding).not_to eq(Encoding.default_internal)
|
871
|
+
expect(@fmo.internal_encoding).to eq(new_encoding)
|
872
|
+
end
|
873
|
+
|
874
|
+
describe "mode_bits" do
|
875
|
+
it "should return File::RDWR" do
|
876
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
877
|
+
end
|
878
|
+
end
|
879
|
+
|
880
|
+
describe "append?" do
|
881
|
+
it "should return false" do
|
882
|
+
expect(@fmo.append?).to be false
|
883
|
+
end
|
884
|
+
end
|
885
|
+
|
886
|
+
describe "binmode?" do
|
887
|
+
it "should return false" do
|
888
|
+
expect(@fmo.binmode?).to be false
|
889
|
+
end
|
890
|
+
end
|
891
|
+
|
892
|
+
describe "create?" do
|
893
|
+
it "should return false" do
|
894
|
+
expect(@fmo.create?).to be false
|
895
|
+
end
|
896
|
+
end
|
897
|
+
|
898
|
+
describe "excl?" do
|
899
|
+
it "should return false" do
|
900
|
+
expect(@fmo.excl?).to be false
|
901
|
+
end
|
902
|
+
end
|
903
|
+
|
904
|
+
describe "noctty?" do
|
905
|
+
it "should return false" do
|
906
|
+
expect(@fmo.noctty?).to be false
|
907
|
+
end
|
908
|
+
end
|
909
|
+
|
910
|
+
describe "nonblock?" do
|
911
|
+
it "should return false" do
|
912
|
+
expect(@fmo.nonblock?).to be false
|
913
|
+
end
|
914
|
+
end
|
915
|
+
|
916
|
+
describe "rdonly?" do
|
917
|
+
it "should return false" do
|
918
|
+
expect(@fmo.rdonly?).to be false
|
919
|
+
end
|
920
|
+
end
|
921
|
+
|
922
|
+
describe "rdwr?" do
|
923
|
+
it "should return true" do
|
924
|
+
expect(@fmo.rdwr?).to be true
|
925
|
+
end
|
926
|
+
end
|
927
|
+
|
928
|
+
describe "trunc?" do
|
929
|
+
it "should return false" do
|
930
|
+
expect(@fmo.trunc?).to be false
|
931
|
+
end
|
932
|
+
end
|
933
|
+
|
934
|
+
describe "wronly?" do
|
935
|
+
it "should return false" do
|
936
|
+
expect(@fmo.wronly?).to be false
|
937
|
+
end
|
938
|
+
end
|
939
|
+
end
|
940
|
+
|
941
|
+
context "external and internal encoding" do
|
942
|
+
before(:each) do
|
943
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+:ascii-8bit:utf-8")
|
944
|
+
end
|
945
|
+
|
946
|
+
it "should set the external and internal encodings to a values other than the default" do
|
947
|
+
new_external_encoding = Encoding.find("ascii-8bit")
|
948
|
+
expect(new_external_encoding).not_to eq(Encoding.default_external)
|
949
|
+
new_internal_encoding = Encoding.find("utf-8")
|
950
|
+
expect(new_internal_encoding).not_to eq(Encoding.default_internal)
|
951
|
+
expect(@fmo.external_encoding).to eq(new_external_encoding)
|
952
|
+
expect(@fmo.internal_encoding).to eq(new_internal_encoding)
|
953
|
+
end
|
954
|
+
|
955
|
+
describe "mode_bits" do
|
956
|
+
it "should return File::RDWR" do
|
957
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
958
|
+
end
|
959
|
+
end
|
960
|
+
|
961
|
+
describe "append?" do
|
962
|
+
it "should return false" do
|
963
|
+
expect(@fmo.append?).to be false
|
964
|
+
end
|
965
|
+
end
|
966
|
+
|
967
|
+
describe "binmode?" do
|
968
|
+
it "should return false" do
|
969
|
+
expect(@fmo.binmode?).to be false
|
970
|
+
end
|
971
|
+
end
|
972
|
+
|
973
|
+
describe "create?" do
|
974
|
+
it "should return false" do
|
975
|
+
expect(@fmo.create?).to be false
|
976
|
+
end
|
977
|
+
end
|
978
|
+
|
979
|
+
describe "excl?" do
|
980
|
+
it "should return false" do
|
981
|
+
expect(@fmo.excl?).to be false
|
982
|
+
end
|
983
|
+
end
|
984
|
+
|
985
|
+
describe "noctty?" do
|
986
|
+
it "should return false" do
|
987
|
+
expect(@fmo.noctty?).to be false
|
988
|
+
end
|
989
|
+
end
|
990
|
+
|
991
|
+
describe "nonblock?" do
|
992
|
+
it "should return false" do
|
993
|
+
expect(@fmo.nonblock?).to be false
|
994
|
+
end
|
995
|
+
end
|
996
|
+
|
997
|
+
describe "rdonly?" do
|
998
|
+
it "should return false" do
|
999
|
+
expect(@fmo.rdonly?).to be false
|
1000
|
+
end
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
describe "rdwr?" do
|
1004
|
+
it "should return true" do
|
1005
|
+
expect(@fmo.rdwr?).to be true
|
1006
|
+
end
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
describe "trunc?" do
|
1010
|
+
it "should return false" do
|
1011
|
+
expect(@fmo.trunc?).to be false
|
1012
|
+
end
|
1013
|
+
end
|
1014
|
+
|
1015
|
+
describe "wronly?" do
|
1016
|
+
it "should return false" do
|
1017
|
+
expect(@fmo.wronly?).to be false
|
1018
|
+
end
|
1019
|
+
end
|
1020
|
+
end
|
1021
|
+
end
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
context "options" do
|
1025
|
+
context "modes" do
|
1026
|
+
context "read write + binmode = :mode => 'r+b'" do
|
1027
|
+
before(:each) do
|
1028
|
+
@fmo = VirtFS::FileModesAndOptions.new(:mode => "r+b")
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
describe "mode_bits" do
|
1032
|
+
it "should return File::RDWR" do
|
1033
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
1034
|
+
end
|
1035
|
+
end
|
1036
|
+
|
1037
|
+
describe "append?" do
|
1038
|
+
it "should return false" do
|
1039
|
+
expect(@fmo.append?).to be false
|
1040
|
+
end
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
describe "binmode?" do
|
1044
|
+
it "should return true" do
|
1045
|
+
expect(@fmo.binmode?).to be true
|
1046
|
+
end
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
describe "create?" do
|
1050
|
+
it "should return false" do
|
1051
|
+
expect(@fmo.create?).to be false
|
1052
|
+
end
|
1053
|
+
end
|
1054
|
+
|
1055
|
+
describe "excl?" do
|
1056
|
+
it "should return false" do
|
1057
|
+
expect(@fmo.excl?).to be false
|
1058
|
+
end
|
1059
|
+
end
|
1060
|
+
|
1061
|
+
describe "noctty?" do
|
1062
|
+
it "should return false" do
|
1063
|
+
expect(@fmo.noctty?).to be false
|
1064
|
+
end
|
1065
|
+
end
|
1066
|
+
|
1067
|
+
describe "nonblock?" do
|
1068
|
+
it "should return false" do
|
1069
|
+
expect(@fmo.nonblock?).to be false
|
1070
|
+
end
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
describe "rdonly?" do
|
1074
|
+
it "should return false" do
|
1075
|
+
expect(@fmo.rdonly?).to be false
|
1076
|
+
end
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
describe "rdwr?" do
|
1080
|
+
it "should return true" do
|
1081
|
+
expect(@fmo.rdwr?).to be true
|
1082
|
+
end
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
describe "trunc?" do
|
1086
|
+
it "should return false" do
|
1087
|
+
expect(@fmo.trunc?).to be false
|
1088
|
+
end
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
describe "wronly?" do
|
1092
|
+
it "should return false" do
|
1093
|
+
expect(@fmo.wronly?).to be false
|
1094
|
+
end
|
1095
|
+
end
|
1096
|
+
end
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
context "binmode" do
|
1100
|
+
context "read write + binmode = :binmode => true, :mode => 'r+'" do
|
1101
|
+
before(:each) do
|
1102
|
+
@fmo = VirtFS::FileModesAndOptions.new(:binmode => true, :mode => "r+")
|
1103
|
+
end
|
1104
|
+
|
1105
|
+
describe "mode_bits" do
|
1106
|
+
it "should return File::RDWR" do
|
1107
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
1108
|
+
end
|
1109
|
+
end
|
1110
|
+
|
1111
|
+
describe "append?" do
|
1112
|
+
it "should return false" do
|
1113
|
+
expect(@fmo.append?).to be false
|
1114
|
+
end
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
describe "binmode?" do
|
1118
|
+
it "should return true" do
|
1119
|
+
expect(@fmo.binmode?).to be true
|
1120
|
+
end
|
1121
|
+
end
|
1122
|
+
|
1123
|
+
describe "create?" do
|
1124
|
+
it "should return false" do
|
1125
|
+
expect(@fmo.create?).to be false
|
1126
|
+
end
|
1127
|
+
end
|
1128
|
+
|
1129
|
+
describe "excl?" do
|
1130
|
+
it "should return false" do
|
1131
|
+
expect(@fmo.excl?).to be false
|
1132
|
+
end
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
describe "noctty?" do
|
1136
|
+
it "should return false" do
|
1137
|
+
expect(@fmo.noctty?).to be false
|
1138
|
+
end
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
describe "nonblock?" do
|
1142
|
+
it "should return false" do
|
1143
|
+
expect(@fmo.nonblock?).to be false
|
1144
|
+
end
|
1145
|
+
end
|
1146
|
+
|
1147
|
+
describe "rdonly?" do
|
1148
|
+
it "should return false" do
|
1149
|
+
expect(@fmo.rdonly?).to be false
|
1150
|
+
end
|
1151
|
+
end
|
1152
|
+
|
1153
|
+
describe "rdwr?" do
|
1154
|
+
it "should return true" do
|
1155
|
+
expect(@fmo.rdwr?).to be true
|
1156
|
+
end
|
1157
|
+
end
|
1158
|
+
|
1159
|
+
describe "trunc?" do
|
1160
|
+
it "should return false" do
|
1161
|
+
expect(@fmo.trunc?).to be false
|
1162
|
+
end
|
1163
|
+
end
|
1164
|
+
|
1165
|
+
describe "wronly?" do
|
1166
|
+
it "should return false" do
|
1167
|
+
expect(@fmo.wronly?).to be false
|
1168
|
+
end
|
1169
|
+
end
|
1170
|
+
end
|
1171
|
+
end
|
1172
|
+
|
1173
|
+
context "external_encoding" do
|
1174
|
+
it "should set the external encoding to a value other than the default" do
|
1175
|
+
new_encoding = Encoding.find("ascii-8bit")
|
1176
|
+
expect(new_encoding).not_to eq(Encoding.default_external)
|
1177
|
+
fmo = VirtFS::FileModesAndOptions.new(:external_encoding => "ascii-8bit", :mode => "r+")
|
1178
|
+
expect(fmo.external_encoding).to eq(new_encoding)
|
1179
|
+
end
|
1180
|
+
end
|
1181
|
+
|
1182
|
+
context "internal_encoding" do
|
1183
|
+
it "should set the internal encoding to a value other than the default" do
|
1184
|
+
new_encoding = Encoding.find("utf-8")
|
1185
|
+
expect(new_encoding).not_to eq(Encoding.default_internal)
|
1186
|
+
fmo = VirtFS::FileModesAndOptions.new(:internal_encoding => "utf-8", :mode => "r+")
|
1187
|
+
expect(fmo.internal_encoding).to eq(new_encoding)
|
1188
|
+
end
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
context "encoding" do
|
1192
|
+
it "should set the external encoding to a value other than the default" do
|
1193
|
+
new_encoding = Encoding.find("ascii-8bit")
|
1194
|
+
expect(new_encoding).not_to eq(Encoding.default_external)
|
1195
|
+
fmo = VirtFS::FileModesAndOptions.new(:encoding => "ascii-8bit", :mode => "r+")
|
1196
|
+
expect(fmo.external_encoding).to eq(new_encoding)
|
1197
|
+
expect(fmo.internal_encoding).to eq(Encoding.default_internal)
|
1198
|
+
end
|
1199
|
+
|
1200
|
+
it "should set the internal encoding to a value other than the default" do
|
1201
|
+
new_encoding = Encoding.find("utf-8")
|
1202
|
+
expect(new_encoding).not_to eq(Encoding.default_internal)
|
1203
|
+
fmo = VirtFS::FileModesAndOptions.new(:encoding => ":utf-8", :mode => "r+")
|
1204
|
+
expect(fmo.internal_encoding).to eq(new_encoding)
|
1205
|
+
expect(fmo.external_encoding).to eq(Encoding.default_external)
|
1206
|
+
end
|
1207
|
+
|
1208
|
+
it "should set the external and internal encodings to a values other than the default" do
|
1209
|
+
new_external_encoding = Encoding.find("ascii-8bit")
|
1210
|
+
expect(new_external_encoding).not_to eq(Encoding.default_external)
|
1211
|
+
new_internal_encoding = Encoding.find("utf-8")
|
1212
|
+
expect(new_internal_encoding).not_to eq(Encoding.default_internal)
|
1213
|
+
fmo = VirtFS::FileModesAndOptions.new(:encoding => "ascii-8bit:utf-8", :mode => "r+")
|
1214
|
+
expect(fmo.external_encoding).to eq(new_external_encoding)
|
1215
|
+
expect(fmo.internal_encoding).to eq(new_internal_encoding)
|
1216
|
+
end
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
context "textmode" do
|
1220
|
+
end
|
1221
|
+
end
|
1222
|
+
|
1223
|
+
context "permissions" do
|
1224
|
+
it "should set permissions when specified after mode" do
|
1225
|
+
permissions = 0755
|
1226
|
+
fmo = VirtFS::FileModesAndOptions.new("r", permissions)
|
1227
|
+
expect(fmo.permissions).to eq(permissions)
|
1228
|
+
end
|
1229
|
+
|
1230
|
+
it "should set permissions when specified after mode and before options" do
|
1231
|
+
permissions = 0755
|
1232
|
+
fmo = VirtFS::FileModesAndOptions.new("r", permissions, :binmode => true)
|
1233
|
+
expect(fmo.permissions).to eq(permissions)
|
1234
|
+
end
|
1235
|
+
end
|
1236
|
+
|
1237
|
+
#
|
1238
|
+
# Test arg combinations.
|
1239
|
+
#
|
1240
|
+
|
1241
|
+
context "mode, permissions" do
|
1242
|
+
context "read write = 'r+' with permissions = 0755" do
|
1243
|
+
before(:each) do
|
1244
|
+
@permissions = 0755
|
1245
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+", @permissions)
|
1246
|
+
end
|
1247
|
+
|
1248
|
+
it "should set permissions accordingly" do
|
1249
|
+
expect(@fmo.permissions).to eq(@permissions)
|
1250
|
+
end
|
1251
|
+
|
1252
|
+
describe "mode_bits" do
|
1253
|
+
it "should return File::RDWR" do
|
1254
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
1255
|
+
end
|
1256
|
+
end
|
1257
|
+
|
1258
|
+
describe "append?" do
|
1259
|
+
it "should return false" do
|
1260
|
+
expect(@fmo.append?).to be false
|
1261
|
+
end
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
describe "binmode?" do
|
1265
|
+
it "should return false" do
|
1266
|
+
expect(@fmo.binmode?).to be false
|
1267
|
+
end
|
1268
|
+
end
|
1269
|
+
|
1270
|
+
describe "create?" do
|
1271
|
+
it "should return false" do
|
1272
|
+
expect(@fmo.create?).to be false
|
1273
|
+
end
|
1274
|
+
end
|
1275
|
+
|
1276
|
+
describe "excl?" do
|
1277
|
+
it "should return false" do
|
1278
|
+
expect(@fmo.excl?).to be false
|
1279
|
+
end
|
1280
|
+
end
|
1281
|
+
|
1282
|
+
describe "noctty?" do
|
1283
|
+
it "should return false" do
|
1284
|
+
expect(@fmo.noctty?).to be false
|
1285
|
+
end
|
1286
|
+
end
|
1287
|
+
|
1288
|
+
describe "nonblock?" do
|
1289
|
+
it "should return false" do
|
1290
|
+
expect(@fmo.nonblock?).to be false
|
1291
|
+
end
|
1292
|
+
end
|
1293
|
+
|
1294
|
+
describe "rdonly?" do
|
1295
|
+
it "should return false" do
|
1296
|
+
expect(@fmo.rdonly?).to be false
|
1297
|
+
end
|
1298
|
+
end
|
1299
|
+
|
1300
|
+
describe "rdwr?" do
|
1301
|
+
it "should return true" do
|
1302
|
+
expect(@fmo.rdwr?).to be true
|
1303
|
+
end
|
1304
|
+
end
|
1305
|
+
|
1306
|
+
describe "trunc?" do
|
1307
|
+
it "should return false" do
|
1308
|
+
expect(@fmo.trunc?).to be false
|
1309
|
+
end
|
1310
|
+
end
|
1311
|
+
|
1312
|
+
describe "wronly?" do
|
1313
|
+
it "should return false" do
|
1314
|
+
expect(@fmo.wronly?).to be false
|
1315
|
+
end
|
1316
|
+
end
|
1317
|
+
end
|
1318
|
+
end
|
1319
|
+
|
1320
|
+
context "mode, options" do
|
1321
|
+
context "read write = 'r+' with options: :encoding => 'ascii-8bit:utf-8'" do
|
1322
|
+
before(:each) do
|
1323
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+", :encoding => "ascii-8bit:utf-8")
|
1324
|
+
end
|
1325
|
+
|
1326
|
+
it "should set the external and internal encodings to a values other than the default" do
|
1327
|
+
new_external_encoding = Encoding.find("ascii-8bit")
|
1328
|
+
expect(new_external_encoding).not_to eq(Encoding.default_external)
|
1329
|
+
new_internal_encoding = Encoding.find("utf-8")
|
1330
|
+
expect(new_internal_encoding).not_to eq(Encoding.default_internal)
|
1331
|
+
expect(@fmo.external_encoding).to eq(new_external_encoding)
|
1332
|
+
expect(@fmo.internal_encoding).to eq(new_internal_encoding)
|
1333
|
+
end
|
1334
|
+
|
1335
|
+
describe "mode_bits" do
|
1336
|
+
it "should return File::RDWR" do
|
1337
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
1338
|
+
end
|
1339
|
+
end
|
1340
|
+
|
1341
|
+
describe "append?" do
|
1342
|
+
it "should return false" do
|
1343
|
+
expect(@fmo.append?).to be false
|
1344
|
+
end
|
1345
|
+
end
|
1346
|
+
|
1347
|
+
describe "binmode?" do
|
1348
|
+
it "should return false" do
|
1349
|
+
expect(@fmo.binmode?).to be false
|
1350
|
+
end
|
1351
|
+
end
|
1352
|
+
|
1353
|
+
describe "create?" do
|
1354
|
+
it "should return false" do
|
1355
|
+
expect(@fmo.create?).to be false
|
1356
|
+
end
|
1357
|
+
end
|
1358
|
+
|
1359
|
+
describe "excl?" do
|
1360
|
+
it "should return false" do
|
1361
|
+
expect(@fmo.excl?).to be false
|
1362
|
+
end
|
1363
|
+
end
|
1364
|
+
|
1365
|
+
describe "noctty?" do
|
1366
|
+
it "should return false" do
|
1367
|
+
expect(@fmo.noctty?).to be false
|
1368
|
+
end
|
1369
|
+
end
|
1370
|
+
|
1371
|
+
describe "nonblock?" do
|
1372
|
+
it "should return false" do
|
1373
|
+
expect(@fmo.nonblock?).to be false
|
1374
|
+
end
|
1375
|
+
end
|
1376
|
+
|
1377
|
+
describe "rdonly?" do
|
1378
|
+
it "should return false" do
|
1379
|
+
expect(@fmo.rdonly?).to be false
|
1380
|
+
end
|
1381
|
+
end
|
1382
|
+
|
1383
|
+
describe "rdwr?" do
|
1384
|
+
it "should return true" do
|
1385
|
+
expect(@fmo.rdwr?).to be true
|
1386
|
+
end
|
1387
|
+
end
|
1388
|
+
|
1389
|
+
describe "trunc?" do
|
1390
|
+
it "should return false" do
|
1391
|
+
expect(@fmo.trunc?).to be false
|
1392
|
+
end
|
1393
|
+
end
|
1394
|
+
|
1395
|
+
describe "wronly?" do
|
1396
|
+
it "should return false" do
|
1397
|
+
expect(@fmo.wronly?).to be false
|
1398
|
+
end
|
1399
|
+
end
|
1400
|
+
end
|
1401
|
+
end
|
1402
|
+
|
1403
|
+
context "mode, permissions, options" do
|
1404
|
+
context "read write = 'r+' with permissions = 0755 and ,options = :encoding => 'ascii-8bit:utf-8'" do
|
1405
|
+
before(:each) do
|
1406
|
+
@permissions = 0755
|
1407
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+", @permissions, :encoding => "ascii-8bit:utf-8")
|
1408
|
+
end
|
1409
|
+
|
1410
|
+
it "should set permissions accordingly" do
|
1411
|
+
expect(@fmo.permissions).to eq(@permissions)
|
1412
|
+
end
|
1413
|
+
|
1414
|
+
it "should set the external and internal encodings to a values other than the default" do
|
1415
|
+
new_external_encoding = Encoding.find("ascii-8bit")
|
1416
|
+
expect(new_external_encoding).not_to eq(Encoding.default_external)
|
1417
|
+
new_internal_encoding = Encoding.find("utf-8")
|
1418
|
+
expect(new_internal_encoding).not_to eq(Encoding.default_internal)
|
1419
|
+
expect(@fmo.external_encoding).to eq(new_external_encoding)
|
1420
|
+
expect(@fmo.internal_encoding).to eq(new_internal_encoding)
|
1421
|
+
end
|
1422
|
+
|
1423
|
+
describe "mode_bits" do
|
1424
|
+
it "should return File::RDWR" do
|
1425
|
+
expect(@fmo.mode_bits).to eq(File::RDWR)
|
1426
|
+
end
|
1427
|
+
end
|
1428
|
+
|
1429
|
+
describe "append?" do
|
1430
|
+
it "should return false" do
|
1431
|
+
expect(@fmo.append?).to be false
|
1432
|
+
end
|
1433
|
+
end
|
1434
|
+
|
1435
|
+
describe "binmode?" do
|
1436
|
+
it "should return false" do
|
1437
|
+
expect(@fmo.binmode?).to be false
|
1438
|
+
end
|
1439
|
+
end
|
1440
|
+
|
1441
|
+
describe "create?" do
|
1442
|
+
it "should return false" do
|
1443
|
+
expect(@fmo.create?).to be false
|
1444
|
+
end
|
1445
|
+
end
|
1446
|
+
|
1447
|
+
describe "excl?" do
|
1448
|
+
it "should return false" do
|
1449
|
+
expect(@fmo.excl?).to be false
|
1450
|
+
end
|
1451
|
+
end
|
1452
|
+
|
1453
|
+
describe "noctty?" do
|
1454
|
+
it "should return false" do
|
1455
|
+
expect(@fmo.noctty?).to be false
|
1456
|
+
end
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
describe "nonblock?" do
|
1460
|
+
it "should return false" do
|
1461
|
+
expect(@fmo.nonblock?).to be false
|
1462
|
+
end
|
1463
|
+
end
|
1464
|
+
|
1465
|
+
describe "rdonly?" do
|
1466
|
+
it "should return false" do
|
1467
|
+
expect(@fmo.rdonly?).to be false
|
1468
|
+
end
|
1469
|
+
end
|
1470
|
+
|
1471
|
+
describe "rdwr?" do
|
1472
|
+
it "should return true" do
|
1473
|
+
expect(@fmo.rdwr?).to be true
|
1474
|
+
end
|
1475
|
+
end
|
1476
|
+
|
1477
|
+
describe "trunc?" do
|
1478
|
+
it "should return false" do
|
1479
|
+
expect(@fmo.trunc?).to be false
|
1480
|
+
end
|
1481
|
+
end
|
1482
|
+
|
1483
|
+
describe "wronly?" do
|
1484
|
+
it "should return false" do
|
1485
|
+
expect(@fmo.wronly?).to be false
|
1486
|
+
end
|
1487
|
+
end
|
1488
|
+
end
|
1489
|
+
end
|
1490
|
+
|
1491
|
+
#
|
1492
|
+
# Error handling.
|
1493
|
+
#
|
1494
|
+
|
1495
|
+
context "errors" do
|
1496
|
+
it "should raise ArgumentError when third arg is not a hash" do
|
1497
|
+
expect do
|
1498
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+", 0755, true)
|
1499
|
+
end.to raise_error(
|
1500
|
+
ArgumentError, "wrong number of arguments (4 for 1..3)"
|
1501
|
+
)
|
1502
|
+
end
|
1503
|
+
|
1504
|
+
it "should raise ArgumentError when external encoding specified twice" do
|
1505
|
+
expect do
|
1506
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+:ascii-8bit", 0755, :external_encoding => "ascii-8bit")
|
1507
|
+
end.to raise_error(
|
1508
|
+
ArgumentError, "encoding specified twice"
|
1509
|
+
)
|
1510
|
+
end
|
1511
|
+
|
1512
|
+
it "should raise ArgumentError when internal encoding specified twice" do
|
1513
|
+
expect do
|
1514
|
+
@fmo = VirtFS::FileModesAndOptions.new("r+::ascii-8bit", 0755, :internal_encoding => "ascii-8bit")
|
1515
|
+
end.to raise_error(
|
1516
|
+
ArgumentError, "encoding specified twice"
|
1517
|
+
)
|
1518
|
+
end
|
1519
|
+
|
1520
|
+
it "should raise ArgumentError when given invalid access mode" do
|
1521
|
+
mode_str = "z+"
|
1522
|
+
expect do
|
1523
|
+
@fmo = VirtFS::FileModesAndOptions.new(mode_str)
|
1524
|
+
end.to raise_error(
|
1525
|
+
ArgumentError, "invalid access mode #{mode_str}"
|
1526
|
+
)
|
1527
|
+
end
|
1528
|
+
|
1529
|
+
it "should raise ArgumentError when binmode specified twice" do
|
1530
|
+
expect do
|
1531
|
+
@fmo = VirtFS::FileModesAndOptions.new("rb", :binmode => true)
|
1532
|
+
end.to raise_error(
|
1533
|
+
ArgumentError, "binmode specified twice"
|
1534
|
+
)
|
1535
|
+
end
|
1536
|
+
|
1537
|
+
#
|
1538
|
+
# This restriction has been removed.
|
1539
|
+
#
|
1540
|
+
# it "should raise ArgumentError when mode specified twice" do
|
1541
|
+
# expect do
|
1542
|
+
# @fmo = VirtFS::FileModesAndOptions.new("rb", :mode => "rb")
|
1543
|
+
# end.to raise_error(
|
1544
|
+
# ArgumentError, "mode specified twice"
|
1545
|
+
# )
|
1546
|
+
# end
|
1547
|
+
|
1548
|
+
it "should raise ArgumentError when both binmode and textmode are specified" do
|
1549
|
+
expect do
|
1550
|
+
@fmo = VirtFS::FileModesAndOptions.new("rb", :textmode => true)
|
1551
|
+
end.to raise_error(
|
1552
|
+
ArgumentError, "binmode and textmode are mutually exclusive"
|
1553
|
+
)
|
1554
|
+
end
|
1555
|
+
end
|
1556
|
+
end
|