Skip to content

Commit 9566354

Browse files
committed
1 parent 5efc31c commit 9566354

File tree

137 files changed

+4267
-4691
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+4267
-4691
lines changed

spec/ruby/core/argf/gets_spec.rb

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,23 @@
2626
end
2727
end
2828

29-
with_feature :encoding do
30-
before :each do
31-
@external = Encoding.default_external
32-
@internal = Encoding.default_internal
29+
before :each do
30+
@external = Encoding.default_external
31+
@internal = Encoding.default_internal
3332

34-
Encoding.default_external = Encoding::UTF_8
35-
Encoding.default_internal = nil
36-
end
33+
Encoding.default_external = Encoding::UTF_8
34+
Encoding.default_internal = nil
35+
end
3736

38-
after :each do
39-
Encoding.default_external = @external
40-
Encoding.default_internal = @internal
41-
end
37+
after :each do
38+
Encoding.default_external = @external
39+
Encoding.default_internal = @internal
40+
end
4241

43-
it "reads the contents of the file with default encoding" do
44-
Encoding.default_external = Encoding::US_ASCII
45-
argf [@file1_name, @file2_name] do
46-
@argf.gets.encoding.should == Encoding::US_ASCII
47-
end
42+
it "reads the contents of the file with default encoding" do
43+
Encoding.default_external = Encoding::US_ASCII
44+
argf [@file1_name, @file2_name] do
45+
@argf.gets.encoding.should == Encoding::US_ASCII
4846
end
4947
end
5048

spec/ruby/core/argf/read_spec.rb

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,24 @@
6262
end
6363
end
6464

65-
with_feature :encoding do
6665

67-
before :each do
68-
@external = Encoding.default_external
69-
@internal = Encoding.default_internal
66+
before :each do
67+
@external = Encoding.default_external
68+
@internal = Encoding.default_internal
7069

71-
Encoding.default_external = Encoding::UTF_8
72-
Encoding.default_internal = nil
73-
end
70+
Encoding.default_external = Encoding::UTF_8
71+
Encoding.default_internal = nil
72+
end
7473

75-
after :each do
76-
Encoding.default_external = @external
77-
Encoding.default_internal = @internal
78-
end
74+
after :each do
75+
Encoding.default_external = @external
76+
Encoding.default_internal = @internal
77+
end
7978

80-
it "reads the contents of the file with default encoding" do
81-
Encoding.default_external = Encoding::US_ASCII
82-
argf [@file1_name, @file2_name] do
83-
@argf.read.encoding.should == Encoding::US_ASCII
84-
end
79+
it "reads the contents of the file with default encoding" do
80+
Encoding.default_external = Encoding::US_ASCII
81+
argf [@file1_name, @file2_name] do
82+
@argf.read.encoding.should == Encoding::US_ASCII
8583
end
8684
end
8785
end

spec/ruby/core/dir/shared/glob.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
DirSpecs.delete_mock_dirs
1212
end
1313

14-
with_feature :encoding do
15-
it "raises an Encoding::CompatibilityError if the argument encoding is not compatible with US-ASCII" do
16-
pattern = "file*".force_encoding Encoding::UTF_16BE
17-
lambda { Dir.send(@method, pattern) }.should raise_error(Encoding::CompatibilityError)
18-
end
14+
it "raises an Encoding::CompatibilityError if the argument encoding is not compatible with US-ASCII" do
15+
pattern = "file*".force_encoding Encoding::UTF_16BE
16+
lambda { Dir.send(@method, pattern) }.should raise_error(Encoding::CompatibilityError)
1917
end
2018

2119
it "calls #to_path to convert a pattern" do

spec/ruby/core/dir/shared/path.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@
1818
dir.send(@method).should == DirSpecs.mock_dir
1919
end
2020

21-
with_feature :encoding do
22-
it "returns a String with the same encoding as the argument to .open" do
23-
path = DirSpecs.mock_dir.force_encoding Encoding::IBM866
24-
dir = Dir.open path
25-
begin
26-
dir.send(@method).encoding.should equal(Encoding::IBM866)
27-
ensure
28-
dir.close
29-
end
21+
it "returns a String with the same encoding as the argument to .open" do
22+
path = DirSpecs.mock_dir.force_encoding Encoding::IBM866
23+
dir = Dir.open path
24+
begin
25+
dir.send(@method).encoding.should equal(Encoding::IBM866)
26+
ensure
27+
dir.close
3028
end
3129
end
3230
end

spec/ruby/core/dir/shared/pwd.rb

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
describe :dir_pwd, shared: true do
2-
with_feature :encoding do
3-
before :each do
4-
@fs_encoding = Encoding.find('filesystem')
5-
end
2+
before :each do
3+
@fs_encoding = Encoding.find('filesystem')
64
end
75

86
it "returns the current working directory" do
@@ -36,14 +34,12 @@
3634
end
3735
end
3836

39-
with_feature :encoding do
40-
it "returns a String with the filesystem encoding" do
41-
enc = Dir.send(@method).encoding
42-
if @fs_encoding == Encoding::US_ASCII
43-
[Encoding::US_ASCII, Encoding::ASCII_8BIT].should include(enc)
44-
else
45-
enc.should equal(@fs_encoding)
46-
end
37+
it "returns a String with the filesystem encoding" do
38+
enc = Dir.send(@method).encoding
39+
if @fs_encoding == Encoding::US_ASCII
40+
[Encoding::US_ASCII, Encoding::ASCII_8BIT].should include(enc)
41+
else
42+
enc.should equal(@fs_encoding)
4743
end
4844
end
4945
end
Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,43 @@
11
require_relative '../../spec_helper'
22

3-
with_feature :encoding do
4-
describe "Encoding.aliases" do
5-
it "returns a Hash" do
6-
Encoding.aliases.should be_an_instance_of(Hash)
7-
end
3+
describe "Encoding.aliases" do
4+
it "returns a Hash" do
5+
Encoding.aliases.should be_an_instance_of(Hash)
6+
end
87

9-
it "has Strings as keys" do
10-
Encoding.aliases.keys.each do |key|
11-
key.should be_an_instance_of(String)
12-
end
8+
it "has Strings as keys" do
9+
Encoding.aliases.keys.each do |key|
10+
key.should be_an_instance_of(String)
1311
end
12+
end
1413

15-
it "has Strings as values" do
16-
Encoding.aliases.values.each do |value|
17-
value.should be_an_instance_of(String)
18-
end
14+
it "has Strings as values" do
15+
Encoding.aliases.values.each do |value|
16+
value.should be_an_instance_of(String)
1917
end
18+
end
2019

21-
it "has alias names as its keys" do
22-
Encoding.aliases.key?('BINARY').should be_true
23-
Encoding.aliases.key?('ASCII').should be_true
24-
end
20+
it "has alias names as its keys" do
21+
Encoding.aliases.key?('BINARY').should be_true
22+
Encoding.aliases.key?('ASCII').should be_true
23+
end
2524

26-
it "has the names of the aliased encoding as its values" do
27-
Encoding.aliases['BINARY'].should == 'ASCII-8BIT'
28-
Encoding.aliases['ASCII'].should == 'US-ASCII'
29-
end
25+
it "has the names of the aliased encoding as its values" do
26+
Encoding.aliases['BINARY'].should == 'ASCII-8BIT'
27+
Encoding.aliases['ASCII'].should == 'US-ASCII'
28+
end
3029

31-
it "has an 'external' key with the external default encoding as its value" do
32-
Encoding.aliases['external'].should == Encoding.default_external.name
33-
end
30+
it "has an 'external' key with the external default encoding as its value" do
31+
Encoding.aliases['external'].should == Encoding.default_external.name
32+
end
3433

35-
it "has a 'locale' key and its value equals the name of the encoding found by the locale charmap" do
36-
Encoding.aliases['locale'].should == Encoding.find(Encoding.locale_charmap).name
37-
end
34+
it "has a 'locale' key and its value equals the name of the encoding found by the locale charmap" do
35+
Encoding.aliases['locale'].should == Encoding.find(Encoding.locale_charmap).name
36+
end
3837

39-
it "only contains valid aliased encodings" do
40-
Encoding.aliases.each do |aliased, original|
41-
Encoding.find(aliased).should == Encoding.find(original)
42-
end
38+
it "only contains valid aliased encodings" do
39+
Encoding.aliases.each do |aliased, original|
40+
Encoding.find(aliased).should == Encoding.find(original)
4341
end
4442
end
4543
end
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
require_relative '../../spec_helper'
22

3-
with_feature :encoding do
4-
describe "Encoding#ascii_compatible?" do
5-
it "returns true if self represents an ASCII-compatible encoding" do
6-
Encoding::UTF_8.ascii_compatible?.should be_true
7-
end
3+
describe "Encoding#ascii_compatible?" do
4+
it "returns true if self represents an ASCII-compatible encoding" do
5+
Encoding::UTF_8.ascii_compatible?.should be_true
6+
end
87

9-
it "returns false if self does not represent an ASCII-compatible encoding" do
10-
Encoding::UTF_16LE.ascii_compatible?.should be_false
11-
end
8+
it "returns false if self does not represent an ASCII-compatible encoding" do
9+
Encoding::UTF_16LE.ascii_compatible?.should be_false
1210
end
1311
end

0 commit comments

Comments
 (0)